Caddy is a web server whose defining feature is what you do not configure: TLS certificates. It obtains them from Let's Encrypt at first request, renews them forever, and redirects HTTP to HTTPS — from a config file that fits in two lines.

The two-line website #

/etc/caddy/Caddyfile
aospix.com {
    root * /srv/aospix/public
    file_server
}
Install, start, done
$ sudo systemctl enable --now caddy
$ curl -I https://aospix.com
HTTP/2 200

That is the whole ceremony: DNS pointing at the machine, ports 80 and 443 reachable, and Caddy handles certificates, renewal, HTTP→HTTPS redirects, and modern TLS defaults with no further attention. Compare nginx plus certbot doing the same job and the trade-off becomes concrete: Caddy trades deep configurability for decisions already made well.

The reverse proxy, equally short #

One front door, several backends
app.aospix.com {
    reverse_proxy 127.0.0.1:8080
}

api.aospix.com {
    reverse_proxy 127.0.0.1:3000 {
        header_up X-Real-IP {remote_host}
    }
}

Each block is a site; reverse_proxy forwards with the standard headers set. The concepts are identical to nginx's — one TLS termination point, many hidden backends — with the vocabulary compressed to essentials.

The features you meet in week two #

WantDirective
Static siteroot * /path + file_server
Proxyreverse_proxy upstream
Compressionencode zstd gzip
Basic authbasic_auth block
Local dev HTTPSlocalhost blocks — self-signed, automatic
Reload configsudo systemctl reload caddy (validates first)

The localhost case is underrated: Caddy serves development sites over HTTPS with a locally-trusted certificate, which catches mixed-content and secure-context bugs before production sees them.

Choosing Caddy or nginx #

PriorityChoose
Fastest correct TLS for small sitesCaddy
Team already fluent, complex needsnginx
Fine-grained tuning, large scalenginx
One binary, few moving partsCaddy

Both sit behind the same DNS and firewall prerequisites — the certificate automation only works when Let's Encrypt can reach port 80/443, so UFW rules come first.

Log locations are the first surprise on a new install: Caddy writes JSON structured logs to the journal — journalctl -u caddy -f is the tail. caddy validate before every reload is the nginx -t habit, transplanted.

Certificates behind the scenes are Let's Encrypt; the proxy pattern is explained separately. The network series continues.