yes, that was the problem.
So I changed folder to home/pi/caddy so pi user can access it.
I put caddyfile also in that folder and changed caddy.service accordly.
here’s the full new version:
Description=Caddy HTTP/2 web server
; User and group the process will run as.
; Letsencrypt-issued certificates will be written to this directory.
; Always set “-root” to something safe in case it gets forgotten in the Caddyfile.
ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/home/pi/caddy/Caddyfile -root=/var/tmp
ExecReload=/bin/kill -USR1 $MAINPID
; Use graceful shutdown with a reasonable timeout
; Limit the number of file descriptors; see
man systemd.exec for more limit settings.
; Unmodified caddy is not expected to use more than that.
; Use private /tmp and /var/tmp, which are discarded after caddy stops.
; Use a minimal /dev
; Hide /home, /root, and /run/user. Nobody will steal your SSH-keys.
; Make /usr, /boot, /etc and possibly some more folders read-only.
; … except /etc/ssl/caddy, because we want Letsencrypt-certificates there.
; This merely retains r/w access rights, it does not add any new. Must still be writable on the host!
; The following additional security directives only work with systemd v229 or later.
; They further retrict privileges that can be gained by caddy. Uncomment if you like.
; Note that you may have to add capabilities required by any plugins in use.
so now something changed.
If i run sudo systemctl start caddy.service -l that’s the new error message:
● caddy.service - Caddy HTTP/2 web server
Loaded: loaded (/etc/systemd/system/caddy.service; enabled)
Active: failed (Result: exit-code) since sab 2017-08-26 18:19:16 CEST; 1min 4 2s ago
Main PID: 602 (code=exited, status=1/FAILURE)
ago 26 18:19:14 jarvis systemd: Started Caddy HTTP/2 web server.
ago 26 18:19:16 jarvis caddy: Activating privacy features...
ago 26 18:19:16 jarvis caddy: Your sites will be served over HTTPS automati cally using Let's Encrypt.
ago 26 18:19:16 jarvis caddy: By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
ago 26 18:19:16 jarvis caddy: https://acme-v01.api.letsencrypt.org/terms
ago 26 18:19:16 jarvis caddy: Please enter your email address so you can re cover your account if needed.
ago 26 18:19:16 jarvis caddy: You can leave it blank, but you'll lose the a bility to recover your account.
ago 26 18:19:16 jarvis caddy: Email address: 2017/08/26 18:19:16 get direct ory at 'https://acme-v01.api.letsencrypt.org/directory': failed to get json "htt ps://acme-v01.api.letsencrypt.org/directory": Get https://acme-v01.api.letsencry pt.org/directory: dial tcp: lookup acme-v01.api.letsencrypt.org on [::1]:53: rea d udp [::1]:37980->[::1]:53: read: connection refused
ago 26 18:19:16 jarvis systemd: caddy.service: main process exited, code=exit ed, status=1/FAILURE
ago 26 18:19:16 jarvis systemd: Unit caddy.service entered failed state.
It’s strange that i see connection refused. Ports 80 and 443 are still open on my router to the pi.