denchenko

Serving a small static site with Caddy

2025-11-08

This site used to be nginx plus a certbot cron job. Caddy does both in one small config and renews certificates on its own.

example.com {
	root * /var/www/site
	file_server
	encode gzip
}

That is the whole thing: Caddy gets a Let's Encrypt certificate on first start, redirects HTTP to HTTPS and keeps the certificate renewed. Ports 80 and 443 need to be reachable for the HTTP challenge.

Things worth adding

Installing from the official apt repository keeps it updated together with the rest of the system.