1. Caddy version (caddy version
):
Version 2.4.6
2. How I run Caddy:
caddy start
or
systemctl start caddy
Frankly it’s not clear to me if best practice for managing a live caddy server is best done with
caddy stop
caddy start
caddy reload
or
systemctl stop caddy
systemctl start caddy
systemctl restart caddy
a. System environment:
Debian 11
b. Command:
root@ssdnodes-65240:/var/log/caddy# ps -aux | grep caddy
caddy 366776 0.0 0.1 306132 26444 ? S 17:03 0:00 php-fpm: pool www
caddy 366777 0.0 0.1 231588 25720 ? S 17:03 0:00 php-fpm: pool www
root 371599 0.0 0.2 738700 43028 pts/0 Sl 20:21 0:00 caddy run --pingback 127.0.0.1:45303
root 372146 0.0 0.0 6204 664 pts/0 S+ 21:06 0:00 grep caddy
root@ssdnodes-65240:/var/log/caddy# systemctl status caddy
● caddy.service - Caddy
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2022-01-20 20:52:21 UTC; 15min ago
Docs: https://caddyserver.com/docs/
Process: 371933 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 371933 (code=exited, status=1/FAILURE)
CPU: 71ms
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: HOME=/var/lib/caddy
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: LOGNAME=caddy
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: USER=caddy
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: INVOCATION_ID=5938f58462bf4894820155e1905fcd6a
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: JOURNAL_STREAM=8:3439508
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: {"level":"info","ts":1642711941.5401554,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","con>
Jan 20 20:52:21 ssdnodes-65240 systemd[1]: Started Caddy.
Jan 20 20:52:21 ssdnodes-65240 caddy[371933]: run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 127.0.0.1:2019: bi>
Jan 20 20:52:21 ssdnodes-65240 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Jan 20 20:52:21 ssdnodes-65240 systemd[1]: caddy.service: Failed with result 'exit-code'.
d. My complete Caddyfile or JSON config:
# Set up global options
{
debug
}
list.14servers.net {
# Set this path to your site's directory.
root * /var/www/lists
# Set up logging
log {
output file /var/log/caddy/list.14servers.net.access.log {
roll_size 3MiB
roll_keep 5
roll_keep_for 48h
}
format console
}
# Set up compression
encode gzip zstd
# Set up PHP FastCGI
php_fastcgi unix//run/php/php8.1-fpm.sock
# Set up TLS Protocols
tls {
protocols tls1.2 tls1.3
}
# Enable static file server
file_server
# Set up reverse proxy
# reverse_proxy localhost:8080
}
3. The problem I’m having:
Am trying to understand how best to consistently start/stop/reload/restart a Caddy instance and whether Caddy will automatically handle associated php-fpm processes, or whether I need to manually start/stop/restart them everytime I change my Caddyfile configuration.
Am also wondering if setting the DEBUG option in my Caddyfile might change either Caddy or Systemd’s stop/start/restart/reload behavior.