I'm setting up a static html webserver where users can upload their own files and create their own websites. I'm using Caddy as the webserver and as far as I understand, every time a new host is added on Caddyfile there's a need to restart Caddy to start serving the new site. I wonder if there's a way to get around that, where the other sites won't be affected or some other way without the need to restart Caddy entirely.
I got an answer from Matt Holt, the creator of Caddy:
You could signal Caddy with USR1, which does a zero-downtime reload.
Caddy can be easily reloaded as such:
From the terminal run the following commands:
1.Get the PID from the running caddy instance:
ps -C caddy
PID TTY TIME CMD
1392 pts/0 00:00:00 caddy
2.Send kill command with USR1 parameter
kill -s USR1 1392
And that's it. Caddy will be reloaded without affecting any other site.