The two most common production web servers we install for clients are Caddy and Nginx. They overlap in capability but differ in configuration model, operational ergonomics, and ecosystem. This article is the comparison we walk clients through when picking which to deploy — not “Caddy is better” or “Nginx is better,” but a workload-by-workload trade-off that produces a decision you can defend in retrospect.
How to verify
Quick capability checks on each:
# Caddy
caddy version
caddy list-modules | wc -l
curl -s http://localhost:2019/config/ | jq . | head
# Nginx
nginx -v
nginx -V 2>&1 | tr ' ' '\n' | grep '\-\-with'
ls /etc/nginx/modules-enabled/
Caddy’s modules are baked in; Nginx’s are loaded from .so files (if dynamic) or compiled in (if static). The list comparison shows which has what.
What’s happening
Caddy is a Go binary with a static module system. The Caddyfile DSL is the configuration surface; an admin HTTP API exposes the running JSON config. Automatic HTTPS via ACME is built in — drop a hostname into the config and a Let’s Encrypt cert provisions on the first start. The release cadence is ~6 months for minor versions, ~2 years for major. The author and primary maintainer is Matt Holt (commercially active via the Caddy company).
Nginx is a C binary with both compiled-in and dynamic modules. The configuration is a custom imperative DSL with directives and contexts (server, location, etc.). No automatic HTTPS — you wire certbot or a similar tool separately. Two product lines: open-source Nginx (this article) and Nginx Plus (commercial, with extra features like active health checks built in). The release cadence is ~3-6 months for minor versions. Long-lived stability and a massive ecosystem.
The two cover overlapping use cases: HTTP serving, reverse proxy, TLS termination, basic load balancing. Both handle thousands of concurrent connections per box. Both can sit behind a CDN. The decision is rarely about “which is more capable” — at the standard edge, either does the job. The decision is about the operating model.
Decision
The trade-off:
| Aspect | Caddy | Nginx |
|---|---|---|
| Config format | Caddyfile DSL (purpose-built) + JSON | Custom imperative DSL |
| Automatic HTTPS | Built in, ACME-driven | External (certbot, etc.) |
| HTTP/3 | Built in (Caddy 2.6+) | Quic module, less mature |
| Module ecosystem | ~80 community plugins, static | ~150+ modules, dynamic load |
| Runtime config changes | Admin HTTP API | Reload via SIGHUP |
| Default storage | Local FS, swap-out backends | N/A (cert state external) |
| Operational maturity | Production-ready, smaller fleet | Decade-plus battle-tested |
| Memory profile | Larger (Go runtime) | Smaller (C, tight binary) |
| Performance ceiling | High, sufficient for most | Higher under extreme load |
| Documentation | Concise, opinionated | Comprehensive, sprawling |
| Configuration discoverability | High (DSL is small) | Medium (many directives) |
| Authentication modules | Built-in basicauth, OAuth via plugin | Multiple modules, varying quality |
| WebSocket support | Native, no boilerplate | Requires proxy_set_header recipe |
| MTLS support | Native in tls block | Requires manual config |
| LB policies in stock binary | random, round_robin, least_conn, ip_hash, header, cookie, uri_hash, first, random_choose | round_robin, ip_hash, hash, random, least_conn, least_time (Plus) |
When to pick Caddy.
- New deployment, no legacy reasons to pick Nginx.
- HTTPS is critical and you do not want certbot in the change log.
- Your team is small and prefers fewer moving pieces (Caddy + Let’s Encrypt is one piece; Nginx + certbot + cron is three).
- The deployment is dynamic (containers come and go) and you want the admin API.
- Your protocol set is HTTP-focused — file serving, reverse proxy, WebSocket.
- You are coming from a Cloud Foundry / Heroku / Render mindset where “just run a binary” is the operating model.
When to pick Nginx.
- You have an existing Nginx fleet and the cost of swapping is real.
- Your workload needs a specific Nginx module not in Caddy’s ecosystem (
ngx_http_perl_module,ngx_http_geoip2_module, a vendor-specific cache module, etc.). - Your team has deep Nginx debugging skills and you would lose that institutional knowledge.
- Your traffic profile pushes the performance ceiling — at the >50k req/s per-box level, Nginx still has the edge on memory and CPU efficiency.
- You need a commercial support contract — Nginx Plus exists; Caddy’s commercial offering is younger.
- Your edge handles non-HTTP TCP/UDP heavily and you do not want a Caddy custom build.
The honest assessment. For 80% of the deployments we install at clients, either works fine. Caddy is the default we reach for on greenfield because the certbot+cron+reload dance is unloved, and the Caddyfile is faster to read at 2am than a 200-line nginx.conf. Nginx is the default when the client is already running it at scale, has Nginx-skilled engineers, or uses a module that has no Caddy equivalent.
Examples — same workload, both servers
A reverse proxy with HTTPS, security headers, and an upstream health check:
Caddyfile:
app.example.com {
encode zstd gzip
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
}
reverse_proxy localhost:3000 {
health_uri /health
health_interval 5s
}
}
Nginx equivalent (open-source):
server {
listen 443 ssl http2;
server_name app.example.com;
ssl_certificate /etc/letsencrypt/live/app.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.example.com/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
gzip on;
gzip_types text/plain text/css application/json application/javascript;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
server_name app.example.com;
return 301 https://$host$request_uri;
}
Plus a certbot cron job to renew. The Caddy version is 8 lines; the Nginx version is 25 lines plus external tooling. Both correctly serve the same workload. Both will run for years untouched.
Operational notes
- Caddy’s “automatic” claim hides operational state — the cert files are on disk at
/var/lib/caddy/.local/share/caddy/. They must be backed up. They must be auditable. The automation does not eliminate the need to know where the state is. - Nginx’s reload model (
nginx -s reload) loads new config; old workers drain. Caddy’ssystemctl reloadis in-process — the same binary continues. Both are zero-downtime for a successful reload. - The “less config” claim for Caddy is real for HTTPS termination, less true for complex matchers. A Caddyfile with 30 matchers, named handlers, and snippet imports is not necessarily shorter than the equivalent Nginx.
- Caddy’s JSON config is more verbose than Nginx config; the Caddyfile is more concise. The right comparison is Caddyfile-to-Nginx for human readability.
- Migrating Nginx to Caddy or vice versa is a 1-2 day effort for a single site, weeks for a fleet. We have done it both ways for clients; it is not a casual switch.
Stack Harbor stands up both Caddy and Nginx for clients, picking per workload rather than as a policy — Caddy as a default for greenfield, Nginx when the ecosystem need is clear. If you are debating which to deploy or considering a migration in either direction and want the trade-offs talked through against your actual stack, this is the kind of conversation our Managed Operations practice runs at the start of every engagement.