ConfigsApr 10, 2026·3 min read

Caddy — Fast Web Server with Automatic HTTPS

Caddy is a modern web server with automatic HTTPS by default. Zero-config TLS certificates, reverse proxy, file server, and load balancer — all in a single binary.

TL;DR
Caddy is a web server written in Go with automatic HTTPS via Let's Encrypt, reverse proxy, file serving, and load balancing in a single binary.
§01

What it is

Caddy is a modern web server written in Go. Its defining feature is automatic HTTPS: Caddy obtains and renews TLS certificates from Let's Encrypt without any configuration. It also functions as a reverse proxy, file server, and load balancer. The entire server ships as a single binary with no external dependencies.

Caddy targets developers and sysadmins who want HTTPS without manual certificate management. It replaces Nginx or Apache for common use cases with dramatically simpler configuration. The Caddyfile configuration format is human-readable and concise.

§02

How it saves time or tokens

Caddy eliminates the certificate management workflow entirely. No certbot, no cron renewal jobs, no manual configuration of TLS settings. Point Caddy at your domain and it handles everything. The Caddyfile format reduces configuration from dozens of Nginx lines to a few lines. Reverse proxy setup is a single line rather than a separate location block.

§03

How to use

  1. Install Caddy: curl -sS https://getcaddy.com | bash or via package manager.
  2. Create a Caddyfile with your domain and proxy/file-server directives.
  3. Run caddy run and Caddy automatically obtains HTTPS certificates.
§04

Example

# Quick reverse proxy (one command)
caddy reverse-proxy --from yourdomain.com --to localhost:3000

# Quick file server with HTTPS
caddy file-server --domain yourdomain.com
# Caddyfile for a typical setup
yourdomain.com {
    reverse_proxy localhost:3000
}

api.yourdomain.com {
    reverse_proxy localhost:8080
}

static.yourdomain.com {
    root * /var/www/static
    file_server
    encode gzip
}
§05

Related on TokRepo

§06

Common pitfalls

  • Caddy needs ports 80 and 443 open for automatic HTTPS. If another process (Nginx, Apache) occupies these ports, Caddy cannot obtain certificates.
  • The Caddyfile syntax is different from Nginx conf. Do not try to translate Nginx config line-by-line; learn the Caddyfile idioms.
  • Caddy's JSON config is the canonical format; the Caddyfile is syntactic sugar. For complex setups, you may need to use the JSON API directly.

Frequently Asked Questions

How does Caddy automatic HTTPS work?+

Caddy uses the ACME protocol to obtain TLS certificates from Let's Encrypt (or ZeroSSL) automatically. It handles domain verification, certificate issuance, and renewal without any configuration. Just specify your domain name.

Can Caddy replace Nginx?+

For most use cases, yes. Caddy handles reverse proxy, file serving, load balancing, and TLS termination. Nginx has more third-party modules and handles higher connection counts. Caddy is simpler for typical web serving.

Does Caddy support load balancing?+

Yes. Caddy supports round-robin, least connections, random, and IP hash load balancing. Configure multiple upstream servers in the reverse_proxy directive.

Is Caddy free for production use?+

Yes. Caddy is open source under the Apache 2.0 license. There is no paid tier for the server itself. The company behind Caddy offers commercial support and enterprise features separately.

Can I use Caddy with Docker?+

Yes. Official Docker images are available. Mount your Caddyfile and data directory, expose ports 80 and 443, and Caddy handles HTTPS automatically inside the container.

Citations (3)
🙏

Source & Thanks

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets