The Evolution Beyond Manual SSL Renewals
For over a decade, Nginx has been the defacto open-source web server. However, managing Certbot renewal cron jobs, configuring cipher suites, and handling certificate challenges introduces maintenance friction.
**Caddy** is an enterprise-grade, memory-safe web server written in Go with **Automatic HTTPS enabled by default**. It provisions, configures, and automatically renews TLS 1.3 certificates from Let's Encrypt or ZeroSSL without requiring external certbot daemons or custom scripts.
Step 1: Install Caddy on Ubuntu 24.04 LTS
Install the official package repository signed with Caddy's keyring:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy
Verify Caddy is active:
sudo systemctl status caddy
Step 2: Configure Reverse Proxy with Zero-Config TLS
Caddy uses a declarative configuration file called the `Caddyfile`. Open `/etc/caddy/Caddyfile`:
sudo nano /etc/caddy/Caddyfile
Replace the default boiler-plate with a production reverse-proxy configuration:
api.yourdomain.com {
# Automatic TLS 1.3 + HTTP/3 (QUIC) enabled by default
# Security Headers
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
Referrer-Policy "strict-origin-when-cross-origin"
}
# Reverse proxy incoming requests to local backend application
reverse_proxy 127.0.0.1:3000 {
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
# Enable gzip and zstd compression
encode gzip zstd
# Access logging
log {
output file /var/log/caddy/api_access.log {
roll_size 10mb
roll_keep 5
}
}
}
Step 3: Validate and Hot-Reload Configuration
Caddy allows hot-reloading configurations with zero downtime and zero dropped sockets:
# Validate syntax before loading
caddy validate --config /etc/caddy/Caddyfile
# Hot reload without dropping active TCP connections
sudo systemctl reload caddy
Within seconds, Caddy solves the ACME TLS-ALPN challenge, obtains an ECC certificate, and begins serving encrypted HTTP/3 traffic.