Pcornel
Web Infrastructure · Web Services

Caddy

Cheat sheet · https://pcornel.dk/topic.php?topic=6270

Back to the Topic

Answer

Caddy is a web server and reverse proxy written in Go whose defining feature is automatic HTTPS: it obtains and renews certificates via ACME and redirects HTTP to HTTPS without extra configuration.

Remember

A site address with a hostname turns on automatic HTTPS. Caddy needs ports 80 and 443 reachable (or DNS challenge) to get certificates, and a persistent data directory to keep them. Validate before reload: caddy validate, then caddy reload.

First checks

  • caddy validate --config /etc/caddy/Caddyfile — config is valid.
  • systemctl status caddy and journalctl -u caddy — startup and certificate issuance messages.
  • curl -s localhost:2019/config/ | jq — running configuration via the admin API.
  • curl -sSI https://<host>/ — certificate and redirect working.

Commands

journalctl -u caddy

Verify in this order

Caddyfile → adapted to JSON → running config (admin API) → automatic HTTPS (ACME, storage) → site routes (reverse_proxy, php_fastcgi, file_server)

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6270

Confirmation

Confirm action

Continue?