Caddy: The Nginx Alternative With Automatic HTTPS
Nginx and Apache are battle-tested, but they carry decades of configuration baggage — and getting HTTPS right still means wiring up Certbot, cron renewals and redirect rules. Caddy is a modern web server written in Go that takes a different approach: automatic HTTPS by default, and a config file so short it fits on a postcard.
The headline feature: HTTPS with zero effort
Point Caddy at a domain and it will automatically obtain and renew a free TLS certificate from Let's Encrypt (or ZeroSSL), redirect HTTP to HTTPS, and keep everything current — no Certbot, no cron job, no manual renewal. This alone removes an entire class of outages: expired certificates.
The Caddyfile is refreshingly short
A complete, production-ready HTTPS site:
example.com {
root * /var/www/example/public
encode gzip zstd
file_server
php_fastcgi unix//run/php/php8.2-fpm.sock
}That's the whole thing. Caddy fetches the certificate, enables compression, serves static files and hands PHP off to FPM. Compare that to the Nginx server block plus a Certbot setup you'd need for the same result.
Reverse proxy in one line
app.example.com {
reverse_proxy 127.0.0.1:3000
}Caddy adds the usual X-Forwarded-* headers automatically and load-balances if you list multiple upstreams.
Is it actually faster than Nginx?
Honestly: for raw static-file throughput, a well-tuned Nginx is typically as fast or slightly faster. Caddy's advantage isn't microbenchmarks — it's operational speed and safety:
- HTTPS works correctly the first time, with modern TLS defaults (TLS 1.3, OCSP stapling).
- HTTP/2 and HTTP/3 (QUIC) are enabled out of the box.
- Sensible security defaults mean fewer footguns.
- Config is small enough that mistakes are rarer.
In other words, Caddy is often faster to ship and harder to misconfigure, which for most teams matters more than a few percent of throughput.
Installing Caddy
# Debian/Ubuntu
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 caddyEdit /etc/caddy/Caddyfile, then sudo systemctl reload caddy. Because certificates are automatic, there's nothing else to schedule.
When to stick with Nginx
Caddy is a great default for new projects and small-to-medium sites. Reach for Nginx when you need very fine-grained control, an existing ecosystem of Nginx modules, or you're integrating with tooling that expects it.