====== Caddy Setup ===== Install and configure Caddy as a reverse proxy with automatic HTTPS. > //Caddy automatically handles HTTPS certificates and routes traffic to your services.// ===== Overview ===== Caddy is a modern web server that automatically handles HTTPS certificates using Let's Encrypt. It serves as a reverse proxy, routing traffic to your backend services while managing TLS certificates automatically. ===== Benefits of Caddy ===== * Automatic HTTPS with Let's Encrypt * Simple configuration with Caddyfile * Automatic certificate renewal * HTTP to HTTPS redirects * Modern security defaults ===== Docker Setup ===== Create a `docker-compose.yml` with Caddy: ```yaml services: caddy: image: caddy:2-alpine container_name: caddy restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config volumes: caddy_data: caddy_config: ``` The `caddy_data` volume stores TLS certificates so they persist across container restarts. ===== Create Caddyfile ===== Create a `Caddyfile` in the same directory: ``` your-domain.com { reverse_proxy whoami:80 } ``` Caddy will automatically: * Obtain a Let's Encrypt certificate * Enable HTTPS * Redirect HTTP to HTTPS * Renew certificates automatically ===== Start Caddy ===== ```bash docker compose up -d ``` ===== Test HTTPS ===== ```bash curl -I https://your-domain.com ``` You should see HTTPS response headers. ===== References ===== * [[https://jamongx.com/caddy-reverse-proxy-docker-https-guide/|Setting Up Caddy Reverse Proxy with Automatic HTTPS (Docker)]] * [[https://blog.gntech.me/posts/2026-05-24-caddy-reverse-proxy-docker/|Caddy Reverse Proxy Docker — Automatic HTTPS and Zero-Downtime Reloads]] * [[https://dev.to/shahadathhs/using-caddy-with-docker-for-production-a-practical-guide-2pe8|Using Caddy with Docker for Production: A Practical Guide]] * [[https://binadit.com/tutorials/configure-caddy-with-docker-containers-and-automatic-ssl|Configure Caddy 2 with Docker SSL Certificates]] ===== See Also ===== * [[hosting:caddy:start|Caddy Overview]] * [[hosting:caddy:configuration|Caddyfile Configuration]] Last updated: 2026-06-19 * [[hosting:start|Return to hosting]]