Caddy is a modern web server with automatic HTTPS, reverse proxy, and load balancing built in.
It uses a simple Caddyfile for configuration and handles TLS certificates automatically via Let's Encrypt.
flowchart LR
Client([Client]) -->|:80/:443| Caddy[Caddy]
Caddy --> ServiceA[Service A]
Caddy --> ServiceB[Service B]
Caddy --> LE[Let's Encrypt]
- Caddy listens on HTTP/HTTPS ports and routes requests based on the Caddyfile.
- TLS certificates are automatically provisioned and renewed via ACME (Let's Encrypt).
- Reverse proxy rules forward traffic to upstream services.
- Configuration is defined in a single
Caddyfile— no YAML or JSON needed.
- Image:
caddy:2-alpine - Container name:
caddy - HTTP port:
80 - HTTPS port:
443 - Persistent data:
caddy_data:/data(certificates)caddy_config:/config
Set via .env (copy from .env.example):
CADDY_HTTP_PORT(default:80)CADDY_HTTPS_PORT(default:443)
From the repository root:
cd caddy
cp .env.example .env
docker compose up -dTest:
curl http://localhostUseful commands:
docker compose ps
docker compose logs -f
docker compose restart
docker compose down- Edit
Caddyfileto add reverse proxy rules, file serving, or redirects. - Use domain names in the Caddyfile to trigger automatic HTTPS.
- Caddy supports on-demand TLS, wildcard certs, and custom certificate authorities.
- Reload config without downtime:
docker compose exec caddy caddy reload --config /etc/caddy/Caddyfile
- Automatic HTTPS requires a publicly reachable domain and ports 80/443 open.
- For local development, Caddy serves HTTP or uses self-signed certs.
- See Caddy docs for full Caddyfile reference.