Installation on Ubuntu
The caddy package in the default Ubuntu/Debian repository is usually outdated. Use the official Cloudsmith APT repository: the commands above add its signing key and source list, then install the current Caddy with a ready-made systemd service.
The systemd service
The package runs Caddy as the caddy system user via a unit granted CAP_NET_BIND_SERVICE, so it can bind ports 80 and 443 without running as root. Edit /etc/caddy/Caddyfile, then sudo systemctl reload caddy to apply changes with zero downtime.
Certificates and state
Automatically issued TLS certificates and Caddy's state are stored under /var/lib/caddy. Preserve this directory across reinstalls to avoid hitting certificate-authority rate limits by re-issuing.