Caddy vs nginx (2026): Which Web Server Should You Choose?

A practical 2026 comparison of config, automatic HTTPS, load balancing and speed, to help you choose the right web server.

6 min read
AI-assisted

Author's AI disclosure

The author reports using AI to help with this article.

The author confirms reviewing this article.

Caddy vs nginx (2026): Which Web Server Should You Choose?

TL;DR: Choose Caddy if you want HTTPS, HTTP/2 and HTTP/3 working from a three-line config, with health checks included. Choose nginx if you need the lowest memory use and highest raw throughput, the biggest ecosystem, or you already run it. The old line "nginx cannot do automatic HTTPS" is out of date: nginx now has an official ACME module, but it is an add-on with fewer features than Caddy's built-in version.

At a glance

Versions are current as of late November 2026.

Caddy

nginx

Latest release

2.11.9

1.30.7 stable, 1.31.9 mainline

Language, license

Go, Apache-2.0

C, 2-clause BSD

Config

Caddyfile, or JSON through a live API

nginx.conf

Automatic HTTPS

Built in, on by default

Opt in, through the ACME module

ACME challenges

HTTP-01, TLS-ALPN-01, DNS-01 (DNS needs a provider plugin)

HTTP-01, TLS-ALPN-01 (no DNS-01, so no wildcards)

HTTP/3

On by default

Supported since 1.25, still labeled experimental, set up by hand

Active health checks

Included

NGINX Plus (paid) only

Raw speed and memory

Good

Usually better

How automatic HTTPS works

Caddy and nginx's ACME module do the same job: prove to a certificate authority that you control the domain, then fetch and renew a certificate on their own.

sequenceDiagram
    participant S as Server
    participant CA as ACME certificate authority
    S->>CA: Request a certificate for example.com
    CA-->>S: Send a challenge token
    S->>S: Publish the token on port 80 (HTTP-01)
    CA->>S: Fetch the token over HTTP
    CA-->>S: Issue the certificate
    S->>S: Serve HTTPS and renew before expiry

Caddy does this for every public domain in its config, using CAs such as Let's Encrypt and ZeroSSL, and it also redirects HTTP to HTTPS. For local names it can issue certificates from its own local CA. Both Caddy and nginx need port 80 or 443 reachable from the internet for the default challenges.

The same job, three ways

The goal: serve example.com over HTTPS and proxy to an app on port 3000.

Caddy. This is the entire config. Caddy gets and renews the certificate, redirects HTTP, enables HTTP/2 and HTTP/3, passes the Host header through, and sets X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host (replacing any values a client sends).

example.com {
    reverse_proxy localhost:3000
}

nginx with certbot (the classic way). After certbot --nginx -d example.com you end up with something like this, plus a renewal timer:

server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    http2 on;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

nginx with the ACME module (excerpt). nginx fetches and renews the certificate itself, with no certbot:

load_module modules/ngx_http_acme_module.so;

http {
    resolver 1.1.1.1;

    acme_issuer letsencrypt {
        uri         https://acme-v02.api.letsencrypt.org/directory;
        contact     [email protected];
        state_path  /var/cache/nginx/acme-letsencrypt;
        accept_terms_of_service;
    }
    acme_shared_zone zone=ngx_acme_shared:1M;

    server {
        listen 80;    # must stay open for ACME HTTP-01 challenges
        location / { return 301 https://$host$request_uri; }
    }

    server {
        listen 443 ssl;
        server_name example.com;

        acme_certificate letsencrypt;
        ssl_certificate       $acme_certificate;
        ssl_certificate_key   $acme_certificate_key;
        ssl_certificate_cache max=2;

        location / {
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;
        }
    }
}

nginx's own example returns 404 on port 80 instead of redirecting, and its docs call that 404 a response served "while listening for challenges". That suggests the module answers challenges before your location rules, but redirects are not documented explicitly, so test a renewal against a staging CA with your redirect in place.

flowchart LR
    subgraph CA["Caddy"]
        direction TB
        A1["Put the domain in the Caddyfile"] --> A2["Caddy gets, renews and serves the certificate"]
    end
    subgraph NC["nginx + certbot"]
        direction TB
        B1["Install certbot and run it"] --> B2["Point ssl_certificate at the files"] --> B3["Certbot renews on a timer"]
    end
    subgraph NM["nginx + ACME module"]
        direction TB
        C1["Install nginx-module-acme"] --> C2["Add acme_issuer and acme_certificate"] --> C3["nginx gets and renews the certificate"]
    end
    CA ~~~ NC ~~~ NM

The nginx module has real limits today:

  • It supports HTTP-01 and TLS-ALPN-01 only, so there is no DNS-01 and no wildcard certificates. Wildcards and regex values in server_name are not accepted.

  • It needs a resolver and an open port 80 listener, and it ships as a separate dynamic module (nginx-module-acme, version 0.4.x). Building it yourself needs a Rust toolchain, and community support is best effort through GitHub.

Caddy handles wildcards through a DNS provider plugin, which means a custom Caddy build that includes your provider (from the Caddy download page or xcaddy). With nginx, keep using certbot or another ACME client with DNS-01 if you need a wildcard certificate.

Reverse proxy and load balancing

Both proxy HTTP, WebSockets and gRPC. The difference is in what the free versions include.

Caddy

nginx (open source)

Balancing policies

random (default), round_robin, least_conn, first, hash-based

Round robin (default), least_conn, ip_hash, hash, and sticky sessions since 1.29.6

Health checks

Active and passive

Passive only. Active checks need NGINX Plus

Retries

lb_retries and lb_try_duration (retries are off by default)

proxy_next_upstream

If you want a backend taken out of rotation before real users hit it, Caddy does that for free. With open-source nginx you rely on failed requests to mark a backend down.

Performance

Third-party results vary a lot, so treat any ratio as a rough guide. The first test I found ran on a 4 vCPU Rocky Linux 10 VM, serving a 164-byte file with hey (100 connections, self-signed certificate), with nginx 1.26.3 and Caddy 2.11.2:

Measurement

nginx

Caddy

HTTP requests per second

60,382

51,826

HTTPS requests per second

53,162

47,437

HTTP p99 latency

4.7 ms

6.9 ms

Idle memory

22.3 MB

53.1 MB

Memory under load

50.5 MB

63.6 MB

nginx delivered 12–17% more throughput with less memory. A second test on a single shared vCPU found it 2–3x faster than Caddy, using just 7 MB of idle memory versus 59 MB. However, the shared-core setup represents a worst case for tiny machines. Both tests favour nginx, especially on smaller hardware, but network, TLS and application performance usually matter more. Benchmark your own workload before choosing.

Extending and ecosystem

  • nginx: The larger ecosystem by far, with more guides, third-party modules, and official Kubernetes projects such as NGINX Gateway Fabric. It keeps adding features. Version 1.30 brought Early Hints, HTTP/2 to backends and Encrypted Client Hello.

  • Caddy: Plugins are compiled into the binary, so adding one means a custom build. In return you get a live JSON admin API for changing config without a restart, and automatic rotation of Encrypted Client Hello keys since 2.11.

Security and upkeep

Both projects ship security fixes often, so enable automatic package updates and watch their advisories. The bug classes differ. This year's nginx fixes include buffer overflows and use-after-free bugs in areas such as HTTP/2 and HTTP/3. The Caddy advisories I found were mostly logic bugs, such as host and path matching, an mTLS check that failed open, and forward_auth.

Gotchas

  • Caddy in Docker: keep its data directory on a persistent volume, or you lose certificates on every restart and risk hitting Let's Encrypt rate limits. Use the staging CA while testing.

  • HTTP/3 uses UDP: open 443/udp in your firewall, for Caddy and nginx alike. If it is blocked, clients quietly fall back to HTTP/2.

  • Behind a CDN or proxy: the default challenges need ports 80 or 443 to reach the server directly. If they do not, use the DNS challenge.

  • nginx ACME module: it is young. Test issuance and renewal on a staging CA before relying on it.

Which one should you pick?

flowchart TD
    A{"Already running nginx at scale, or need nginx-only modules or Kubernetes ingress?"}
    A -- Yes --> B["Stay with nginx. Add the ACME module if you want built-in HTTPS"]
    A -- No --> C{"Want HTTPS, HTTP/3 and health checks with minimal config?"}
    C -- Yes --> D["Use Caddy"]
    C -- No --> E{"Is memory or raw throughput your top constraint?"}
    E -- Yes --> F["Use nginx"]
    E -- No --> G["Either works. Pick the config style you prefer"]

Verdict

For a new small to medium project, Caddy gets you to a secure, modern setup with the least config and the fewest moving parts. nginx remains the better fit when efficiency, ecosystem and fine-grained control matter most, and its new ACME module closes much of the HTTPS gap, though not wildcards. You do not have to choose forever: both are free, so try Caddy on a side project and keep nginx where it already earns its place.

Sources

Comments0

Log in to join the discussion.

No comments yet.

Samod Alex

Read articles by this author.

Subscribe to Samod Alex's newsletter

Get the articles this author chooses to send by email.