How many lines of config do ten apps take?
Caddy needs 3 lines per app and nothing else, about 30 lines for ten apps. Traefik needs a static config of about 24 lines once, then 2 Docker labels per app. Nginx needs a redirect block and an HTTPS server block per app, about 20 lines each, plus a certbot run per domain. A shared include file brings Nginx down to about 170.
| Proxy | Written once | Per app | Ten apps | Certificates |
|---|---|---|---|---|
| Caddy | 0 lines (3 if you add an email) | 3 lines | 30 to 33 | Automatic, built in |
| Traefik (Docker labels) | 24 lines of YAML, plus the Traefik container | 2 labels | about 44 | Automatic, built in (ACME resolver) |
| Nginx, everything spelled out | 4-line map block for WebSockets | 20 lines | about 204 | certbot, one run per domain |
| Nginx with a shared proxy include | 4-line map plus a 5-line include file | 16 lines | about 170 | certbot, one run per domain |
| Nginx + HTTP/3 | add quic_* settings once | +2 lines | add about 20 | same |
You can shave Nginx further with templates or Ansible, but then you're maintaining the template instead.
What does the Caddy config look like for ten apps?
A Caddyfile for ten apps is ten blocks of three lines. Each block names the domain and the port the app listens on. Adding app eleven means adding three more lines and running caddy reload.
app1.example.com {
reverse_proxy localhost:3001
}
app2.example.com {
reverse_proxy localhost:3002
}
# ...eight more blocks like these
That's the whole file. The reverse proxy quick start shows the same shape: a domain, then reverse_proxy with a port, and Caddy "automatically provisions a trusted certificate".
The reverse_proxy docs list what Caddy does on its own:
- It sets
X-Forwarded-For,X-Forwarded-ProtoandX-Forwarded-Host. - It passes the
Hostheader through. - It ignores spoofed forwarding headers from clients.
- It handles WebSocket upgrades.
It serves HTTP/1.1, HTTP/2 and HTTP/3 too: the global options docs list the default protocols as h1 h2 h3.
What does the Nginx config look like for ten apps?
Nginx needs two server blocks per app: one on port 80 that redirects to HTTPS, and one on port 443 with the certificate paths and the proxy headers. It doesn't get certificates on its own, so you run certbot once per domain, and certbot's timer renews them.
Written out for one app, with WebSocket support:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name app1.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
http2 on;
server_name app1.example.com;
ssl_certificate /etc/letsencrypt/live/app1.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app1.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
The map block goes in once. The two server blocks repeat ten times with a new name and port. Most of those lines exist because Nginx's defaults are built for a different job.
| Line | Why Nginx needs it |
|---|---|
proxy_set_header Host $host | The proxy module docs list the default Host as $proxy_host, the upstream's address rather than the domain the visitor asked for |
Upgrade, Connection and the map | The WebSocket docs say Upgrade is a hop-by-hop header and "is not passed from a client to proxied server" |
proxy_http_version 1.1; | Only on Nginx older than 1.29.7, where the default was 1.0 |
Nginx is getting its own way to fetch certificates. The official ngx_http_acme_module handles ACME certificates inside Nginx.
| ACME module caveat | Detail |
|---|---|
| Not in the default build | Ships separately as nginx-acme, packaged as nginx-module-acme |
| No wildcards | Supports only the http-01 and tls-alpn-01 challenges |
| Still needs config | An acme_issuer block, a shared zone and three lines per server |
So it shrinks the certbot step, not the config.
What does the Traefik config look like for ten apps?
Traefik splits config in two. A static file sets up the ports, the HTTPS redirect, the Let's Encrypt resolver and the Docker provider. Then each app's container gets labels saying which domain routes to it.
The static file, traefik.yml:
entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443
http3: {}
http:
tls:
certResolver: le
certificatesResolvers:
le:
acme:
email: you@example.com
storage: /letsencrypt/acme.json
httpChallenge:
entryPoint: web
providers:
docker:
exposedByDefault: false
Then, per app, in its Compose file:
services:
app1:
image: ghcr.io/you/app1
labels:
- traefik.enable=true
- traefik.http.routers.app1.rule=Host(`app1.example.com`)
| Piece | Where it's documented |
|---|---|
The redirect, http3 and http.tls.certResolver | Entrypoints page. The resolver applies "on every router attached to the entryPoint", which keeps the per-app labels to two. |
| The resolver block | ACME page |
| The label names | Docker routing reference |
A container with more than one port needs a third label:
- traefik.http.services.app1.loadbalancer.server.port=3000
Two things to know. First, Traefik's Docker provider defaults to exposedByDefault: true (Docker provider docs). Every container gets a route unless you turn that off, as above. Second, Traefik needs access to the Docker socket to watch containers. That's a lot of trust to hand a process that faces the internet.
If your apps don't run in Docker, Traefik's file provider works, but then you write YAML routes by hand and most of its advantage is gone.
How do you run Caddy in Docker Compose in front of multiple apps?
Put Caddy and your apps in one Compose file, publish ports only on Caddy, and point the Caddyfile at the apps by service name. Compose puts every service on a shared default network. So Caddy reaches app1:3000, while nothing outside the server can.
services:
caddy:
image: caddy:2
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./conf:/etc/caddy
- caddy_data:/data
- caddy_config:/config
app1:
image: ghcr.io/you/app1
restart: unless-stopped
app2:
image: ghcr.io/you/app2
restart: unless-stopped
volumes:
caddy_data:
caddy_config:
app1.example.com {
reverse_proxy app1:3000
}
app2.example.com {
reverse_proxy app2:3000
}
The ports, volumes and reload command follow the official Caddy image docs. 443/udp is for HTTP/3. The caddy_data volume is the one not to lose. The docs say it "must not be treated as a cache", because it holds your certificates and private keys. After editing the Caddyfile, run docker compose exec -w /etc/caddy caddy caddy reload.
The apps have no ports: on purpose. Docker's docs warn that published ports skip ufw: traffic "gets diverted before it goes through the ufw firewall settings" (Docker and ufw). If Caddy is the only service with ports, it's the only way in.
For label-based routing instead, the labels of caddy-docker-proxy are short, and it reloads Caddy gracefully when containers change:
caddy: app1.example.com
caddy.reverse_proxy: "{{upstreams 3000}}"
If you run Docker on a plain server, my Docker hosting piece covers what that costs.
Caddy as a load balancer for two servers
Give reverse_proxy two upstreams, a policy and a health check:
app.example.com {
reverse_proxy 10.0.0.2:3000 10.0.0.3:3000 {
lb_policy least_conn
health_uri /health
lb_try_duration 5s
}
}
lb_try_duration tells Caddy how long to keep trying other upstreams when the one it picked is down, so a request waits briefly instead of failing. The two addresses can be containers on one server or apps on two servers over a private network. Run a Caddy like this on each server and you don't need to rent a load balancer for a small cluster.
Is Nginx faster than Caddy and Traefik?
Yes, in published benchmarks Nginx usually comes out ahead on requests per second and latency. Caddy and Traefik trade second place depending on the test. But the gaps show up at tens of thousands of requests per second on a 4-core machine. Ten side projects on one server are nowhere near that, so speed shouldn't decide this for you.
Benchmark setups differ a lot, so compare within a row, not across rows.
| Test | Setup | Nginx | Caddy | Traefik |
|---|---|---|---|---|
| Tyler Langlois, 2022 | AWS c5.xlarge (4 cores), reverse proxy, 500 clients, 30 s, k6 | ~537K requests, 24.7 ms median (tuned config) | ~351K requests, 39.6 ms median | not tested |
| Same test | Same setup, 10,000 clients | Default config refused 99%+ of connections | Zero errors, 1,228 ms median latency | not tested |
| Traefik forum, Nov 2025 | 4 vCPU AMD, user-run test | 26,380 req/s, 3.84 ms avg | 15,052 req/s, 6.84 ms avg | 20,795 req/s, 4.86 ms avg (v3 with FastProxy) |
| ComputingForGeeks, Mar 2026 | 4 vCPU, 4 GB VM, 100 connections, static HTTPS | 53,162 req/s | 47,437 req/s | not tested |
The Langlois test is the one I'd read in full. Tuned Nginx pushed more requests, while Caddy at its defaults degraded slowly instead of refusing connections. The forum numbers come from a Traefik community member. They put Traefik between the two once its FastProxy option is on.
How much memory do Caddy, Nginx and Traefik use?
Nginx uses the least, Caddy a bit more, and Traefik the most in user reports, but all three sit in the tens of megabytes. None of the three projects publishes an official memory figure, so these come from tests.
| Source | Nginx | Caddy | Traefik |
|---|---|---|---|
| ComputingForGeeks, static HTTPS, 100 connections | 50.5 MB | 63.6 MB | not tested |
| Private DevOps, 10,000 connections, 4-core VM | about 32 MB | about 58 MB | not tested |
| Traefik forum thread, one user's test | – | – | more than 2x Nginx and Caddy |
Private DevOps warns that proxy benchmarks are "enormously sensitive" to setup.
On a 4 GB server running ten apps, the proxy is a rounding error next to the apps. A Netcup VPS 500 has 4 GB of RAM for €8.26 a month incl. VAT on a 12-month term, and Netcup also sells it from its Manassas datacenter in the US. Hetzner's CX23 has 4 GB for $6.49 plus $0.60 for an IPv4 address, in Germany and Finland only (Hetzner pricing). Even a proxy that used a few hundred MB would leave most of either server for your apps.
What if you'd rather not keep proxy config at all?
Then pick none of them by hand. Self-hosted platforms like Coolify and Dokploy put a proxy in front of your apps for you. PaaS pricing shows what you pay a platform to do the same.
I build Ployz so nobody has to write proxy config. Every Ployz server serves https itself with Caddy. Your coding agent runs it. Paste one line into Claude Code, Codex or Cursor and it deploys your repo.
ployz up --server root@your-server
Point your own domain at a service and it gets https. Several servers share one private network, and each one serves https. A small cluster needs no load balancer to rent. Deleting a domain waits for you. Ployz is free on any number of servers.
Let your coding agent put your apps behind HTTPS on your own servers with Ployz.