Skip to main content
🎤 Luca Berton is speaking at Red Hat Summit & KubeCon EU 2026!Learn more →
Back to Blog

Nginx vs Caddy vs Traefik Compared

Compare Nginx, Caddy, and Traefik as reverse proxies. Auto-HTTPS, config complexity, performance, and container integration.

Luca BertonMarch 12, 20262 min read

Choosing a reverse proxy is one of the first infrastructure decisions for any web application. Nginx, Caddy, and Traefik each take a different approach.

Quick Comparison

FeatureNginxCaddyTraefik
Auto HTTPSNo (needs certbot)Yes (built-in)Yes (built-in)
Config formatCustom syntaxCaddyfile / JSONYAML / TOML / labels
Docker integrationManual configManual configAutomatic (labels)
PerformanceExcellentVery goodGood
Memory usageLowLowMedium
Learning curveMediumLowMedium
Kubernetes ingressnginx-ingressNot commonTraefik ingress

Nginx

The industry standard. Powers ~34% of all websites.

nginx
# /etc/nginx/sites-available/app
server {
    listen 80;
    server_name app.example.com;
    return 301 https://$host$request_uri;
}

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;

    location / {
        proxy_pass http://localhost:3000;
        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;
    }

    location /api {
        proxy_pass http://localhost:8080;
    }

    # Static files with caching
    location /static {
        alias /var/www/static;
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
}

Pros: Battle-tested, highest performance, most documentation, excellent for static files Cons: No auto-HTTPS, config reload required for changes, verbose configuration

Related Course

Master this topic with hands-on labs

Go beyond reading — build real projects in sandboxed environments with expert video guidance.

Browse Courses →

Caddy

Automatic HTTPS with zero configuration:

# Caddyfile
app.example.com {
    reverse_proxy localhost:3000
}

api.example.com {
    reverse_proxy localhost:8080
}

static.example.com {
    root * /var/www/static
    file_server
    header Cache-Control "public, max-age=31536000, immutable"
}

That is the entire configuration. Caddy automatically: - Obtains Let's Encrypt certificates - Redirects HTTP → HTTPS - Renews certificates before expiry - Enables HTTP/2 and HTTP/3

Pros: Simplest config, auto-HTTPS, HTTP/3, single binary, great for small-medium deployments Cons: Smaller ecosystem, less documentation than Nginx, not as fast under extreme load

Traefik

Built for containers and microservices:

yaml
# docker-compose.yml
services:
  traefik:
    image: traefik:v3
    command:
      - --providers.docker=true
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --certificatesresolvers.le.acme.email=admin@example.com
      - --certificatesresolvers.le.acme.storage=/acme.json
      - --certificatesresolvers.le.acme.tlschallenge=true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./acme.json:/acme.json

  web:
    image: my-web-app
    labels:
      - "traefik.http.routers.web.rule=Host(`app.example.com`)"
      - "traefik.http.routers.web.tls.certresolver=le"

  api:
    image: my-api
    labels:
      - "traefik.http.routers.api.rule=Host(`api.example.com`)"
      - "traefik.http.routers.api.tls.certresolver=le"

Add a new service → Traefik discovers it automatically via Docker labels. No config reload, no restart.

Pros: Auto-discovery from Docker/Kubernetes, auto-HTTPS, dashboard, middleware ecosystem Cons: Docker socket access is a security concern, more complex config for non-container use, higher memory usage

Stay Updated

Get weekly IT automation tips

Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.

Subscribe Free →

When to Use Each

ScenarioBest ChoiceWhy
High-traffic static siteNginxBest static file performance
Simple reverse proxyCaddyEasiest config, auto-HTTPS
Docker Compose stackTraefikAuto-discovery, no config per service
Kubernetes ingressTraefik or NginxBoth have mature ingress controllers
Legacy/enterpriseNginxMost teams already know it
Personal projectsCaddyZero-config HTTPS, single binary
Microservices platformTraefikDynamic service discovery

Load Balancing

Nginx

nginx
upstream backend {
    server 10.0.1.10:3000 weight=3;
    server 10.0.1.11:3000;
    server 10.0.1.12:3000 backup;
}

server {
    location / {
        proxy_pass http://backend;
    }
}

Caddy

app.example.com {
    reverse_proxy 10.0.1.10:3000 10.0.1.11:3000 {
        lb_policy round_robin
        health_uri /health
        health_interval 10s
    }
}

Traefik

yaml
# Automatic — scales with Docker replicas
services:
  web:
    image: my-app
    deploy:
      replicas: 3
    labels:
      - "traefik.http.services.web.loadbalancer.server.port=3000"
      - "traefik.http.services.web.loadbalancer.healthcheck.path=/health"

What's Next?

Our Docker Fundamentals course covers reverse proxy patterns with containerized applications. Our Terraform for Beginners course teaches infrastructure provisioning including load balancer setup. First lessons are free. -e ---

Ready to go deeper? Explore our hands-on DevOps courses — practical labs covering Docker, Ansible, Terraform, and more.

Ready to learn by doing?

Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.

Share this article
LB
Luca Berton

Docker Captain, IT automation expert, Red Hat Summit & KubeCon speaker. Building hands-on education for DevOps engineers at CopyPasteLearn.

Related Articles

Explore topics

Browse more articles on the topics covered here.