Running Caddy as systemd service

I am still trying to get Caddy 0.9.3 up running on a Raspberry Pi 2 running Ubuntu Server. Everything runs great when I run it from the command! But I am trying to get it running as a daemon as www-data. I followed the directions given here: https://github.com/mholt/caddy/tree/master/dist/init/linux-systemd, but I am getting this status error message. What does this error mean, so I can troubleshoot? Thank you!

● caddy.service - Caddy HTTP/2 web server
   Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Tue 2016-11-08 17:19:59 EST; 1s ago
 Docs: https://caddyserver.com/docs
  Process: 3966 ExecStart=/usr/local/bin/caddy -log stdout -errors stderr -agree=true -conf=
 Main PID: 3966 (code=exited, status=1/FAILURE)

Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Unit entered failed state.
Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Failed with result 'exit-code'.
Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Service hold-off time over, scheduling r
Nov 08 17:19:59 ubuntu systemd[1]: Stopped Caddy HTTP/2 web server.
Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Start request repeated too quickly.
Nov 08 17:19:59 ubuntu systemd[1]: Failed to start Caddy HTTP/2 web server.
Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Unit entered failed state.
Nov 08 17:19:59 ubuntu systemd[1]: caddy.service: Failed with result 'start-limit-hit'.
~

Looks like the Caddy process exited. Caddy’s logs should give us more information on why that is. What does your Caddyfile look like, and what do you get from journalctl -f -u caddy.service?

Edit: I note that this part seems cut off:

Process: 3966 ExecStart=/usr/local/bin/caddy -log stdout -errors stderr -agree=true -conf=

From the unit configuration, the ExecStart should be /usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile -root=/var/tmp. This shouldn’t cause Caddy to exit, though, as far as I know.

What’s in Caddy’s log?

It’s now giving me this error when I execute caddy:

Activating privacy features... 2016/11/13 10:03:13 [gzip] failed to get certificate: acme: Error 400 - urn:acme:error:malformed - DNS name does not have enough labels

Your Caddyfile must always start with the site to serve :wink:

Thank you. I did have the domain right, but had an error in the Caddyfile. I put an errors{} section outside the brackets for the domain.