diff --git a/dist/init/linux-upstart/README.md b/dist/init/linux-upstart/README.md index 3fd99fda..33af460f 100644 --- a/dist/init/linux-upstart/README.md +++ b/dist/init/linux-upstart/README.md @@ -9,5 +9,6 @@ Short recap: * Download Caddy in `/usr/bin/caddy` and execute `sudo setcap cap_net_bind_service=+ep /usr/bin/caddy`. * Save the upstart config file in `/etc/init/caddy.conf`. +* Ensure that the folder `/etc/caddy` exists and that the subfolder .caddy is owned by `www-data`. * Create a Caddyfile in `/etc/caddy/Caddyfile`. -* Now you can use `sudo service caddy start|stop|restart`. \ No newline at end of file +* Now you can use `sudo service caddy start|stop|restart`. diff --git a/dist/init/linux-upstart/caddy.conf b/dist/init/linux-upstart/caddy.conf index bddc9ac7..43a6cd09 100644 --- a/dist/init/linux-upstart/caddy.conf +++ b/dist/init/linux-upstart/caddy.conf @@ -1,9 +1,9 @@ -description "Caddy startup script" -author "Mathias Beke" +description "Caddy HTTP/2 web server" start on runlevel [2345] stop on runlevel [016] +console log setuid www-data setgid www-data @@ -11,8 +11,13 @@ setgid www-data respawn respawn limit 10 5 -limit nofile 4096 4096 +# Let's Encrypt certificates will be written to this directory. +env HOME=/etc/caddy + +limit nofile 1048576 1048576 script - exec /usr/bin/caddy -agree=true -conf=/etc/caddy/Caddyfile -end script \ No newline at end of file + cd /etc/caddy + rootdir="$(mktemp -d -t "caddy-run.XXXXXX")" + exec /usr/bin/caddy -agree -log=stdout -conf=/etc/caddy/Caddyfile -root=$rootdir +end script