Caddy run --pidfile

1. Caddy version (caddy version): v2.4.6

v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=

2. How I run Caddy:

After boot of the server using the Caddyfile.

a. System environment:

Ubuntu 20.04.3 LTS

b. Command:

caddy start --pidfile /var/run/ --config /etc/caddy/Caddyfile

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:


3. The problem I’m having:

Starting Caddy with caddy start --pidfile /var/run/ at a prompt I can give the option --pidfile (see b.). When caddy starts at boot there is no pidfile. So my question is, can I give the option --pidfile somewhere (and how) so that the pidfile also is created at boot?

4. Error messages and/or full log output:


5. What I already tried:

I put the pidfile option in the GlobaL options block of the Caddyfile. Validating the Caddyfile I got an error unrecognized global option: pidfile.

6. Links to relevant resources:


Is /var/run writable by the user you’re running Caddy with?

Since you’re on Ubuntu, it’s strongly recommended you run as a systemd service instead. If you installed Caddy with our apt repo, then this should already be set up for you.

1 Like

Thanks for the reply. This helped. Indeed I had to put the pidfile somewhere else because of rights issues.

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