Caddy Service Restarts Forever

Caddy 自动重启

My Caddy service is running on a Ubuntu Server. Recently I found that the web service is not stable. After checking the system log journalctl -f, the Caddy service is restarting again and again, but there wasn’t any error logs.

Then I checked the caddy binary command help, and found this:

run            Starts the Caddy process and blocks indefinitely
start          Starts the Caddy process in the background and then returns

My caddy.service file is :


[Unit]
Description=caddy service
After=network.target

[Service]
User=root
Group=root
Type=simple
Restart=always
RestartSec=15s
WorkingDirectory=/root/caddy
ExecStart=/root/caddy/caddy start

[Install]
WantedBy=multi-user.target

After changing ExecStart=/root/caddy/caddy start to ExecStart=/root/caddy/caddy run, the service works correctly.