Using Digitalocean image for caddy, but systemctl launched caddy does not find the caddyfile

1. Caddy version (caddy version):


2. How I run Caddy:

its part of the caddy image, it starts on its own

a. System environment:

Caddy 2.2.1 on Ubuntu 18.04 official image

b. Command:

it starts on its own

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:


# Set this path to your site's directory.
root * /var/www/html

# Enable the static file server.

log {
	output file /var/log/caddy.log

encode zstd gzip

3. The problem I’m having:

If it update the caddyfile in /etc/caddy and do systemctl reload caddy it clearly restarts caddy but no content is served at all via a browser

If I kill caddy via systemctl, then run it manually from inside the /etc/caddy with caddy start everything is fine; clearly systemd is not set up correctly to launch caddy with the caddyfile

4. Error messages and/or full log output:

No output

5. What I already tried:

Running it manually works great, running with syscontrl does nothing. I looked for a caddy.service file but I don’t see one. Where should it be, or why is something called an official image not set up?

6. Links to relevant resources:

If you launched the image recently, you should upgrade to Caddy v2.3.0 with sudo apt update && sudo apt upgrade.

If not, when did you provision the droplet? It might be from before the image installed caddy with the apt repo. In which case, you should probably reprovision the droplet from the latest image.

The systemd config for Caddy should be found at /lib/systemd/system/caddy.service

You can see Caddy’s logs with journalctl -u caddy --no-pager | less

I created the droplet Monday. I knew it was 2.21 but wanted to see it working first before updating.

I updated to 2.30 and rebooted.

Apparently I needed to put the log file into a directory owned by caddy, which then allowed me to see the access failed with a 403 due to the web content being owned by root with no read permission which is why I saw no content.

A comedy of errors!

Thanks for the help.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.