1. Caddy version (caddy version
):
v2.4.5
2. How I run Caddy:
sudo systemctl start/stop/reload/reset-failed caddy
a. System environment:
Ubuntu 20.04 with apt install of caddy
b. Command:
sudo systemctl start caddy
c. Service/unit/compose file:
systemd
d. My complete Caddyfile or JSON config:
root.mydomain.tld {
# Set this path to your site's directory.
root * /var/www/html
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
php_fastcgi unix//run/php/php7.4-fpm.sock
}
service1.mydomain.tld {
encode zstd gzip
reverse_proxy xxx.yyy.zzz.aaa:80
php_fastcgi unix//run/php/php7.4-fpm.sock
}
service2.mydomain.tld {
encode zstd gzip
reverse_proxy :2812
php_fastcgi unix//run/php/php7.4-fpm.sock
}
3. The problem I’m having:
Hi all
I am quite new to caddy and love it thus far but i have to hold my breath every time that i try to amend the caddyfile…
Every time I modify my Caddyfile and try to reload, i get an error message whatever the sequence of commands. It seems that only waiting for a little while after having stopped caddy clears it. I am then able to restart without issue. I am not sure though that this is the expected behaviour…
What is the exact suite of commands to instruct to reload a modified caddyfile without the impression to be breaking the process?
Sorry for the basic question but I could not find explicit guidance on this and it seems to depend on install & environment a lot…
sudo systemctl daemon-reload
sudo systemctl restart caddy
or
caddy stop
caddy reload -confic /path/to/config
caddy start
4. Error messages and/or full log output:
Output of sudo systemctl status caddy
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: {"level":"info","ts":1632221027.5625596,"logger":"http","msg":"enabling automatic HTTP->
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: {"level":"info","ts":1632221027.5625982,"logger":"http","msg":"enabling automatic HTTP->
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: {"level":"info","ts":1632221027.5650213,"logger":"tls","msg":"cleaning storage unit","d>
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: {"level":"info","ts":1632221027.5655785,"logger":"tls.cache.maintenance","msg":"stopped>
Sep 21 12:43:47 root.mydomain.tld systemd[1]: Started Caddy.
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: 2021/09/21 12:43:47 [ERROR] Deleting old OCSP staples: context canceled
Sep 21 12:43:47 root.mydomain.tld caddy[3006]: run: loading initial config: loading new config: http app module: start: tcp: listening>
Sep 21 12:43:47 root.mydomain.tld systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Sep 21 12:43:47 root.mydomain.tld systemd[1]: caddy.service: Failed with result 'exit-code'.
Sep 21 12:43:49 root.mydomain.tld systemd[1]: caddy.service: Unit cannot be reloaded because it is inactive.
output of sudo caddy cmd
2021/09/21 10:45:46.946 WARN failed using API to stop instance {"error": "performing request: Post \"http://localhost:2019/stop\": dial tcp [::1]:2019: connect: connection refused"}
stop: performing request: Post "http://localhost:2019/stop": dial tcp [::1]:2019: connect: connection refused
5. What I already tried:
A number of permutations of commands…