Caddy

A modern web server with automatic HTTPS and a very short config format, great for small teams and simple deployments.

Intermediate · about 4 hours · difficulty 1/5

Learn first: How Web Servers Serve Traffic

Caddy is an alternative to Nginx whose headline feature is automatic HTTPS: point a domain at the server and Caddy obtains and renews certificates via ACME with no extra tooling.

What to learn

  • The Caddyfile format: a site address followed by directives, for example reverse_proxy localhost:3000, file_server, encode gzip, handle_path /api/*.
  • The JSON config and admin API for dynamic configuration.
  • Load balancing across multiple upstreams with health checks.
  • Plugins via xcaddy builds (DNS challenge providers, extra auth).

Where it fits

Excellent for side projects, internal tools and small services where fewer moving parts matters more than a huge ecosystem. Nginx remains more common in large organisations and job postings, so knowing its concepts still pays off.

Pitfalls

Port 80 and 443 must be reachable for the default HTTP challenge, and rate limits from the CA apply if you repeatedly wipe certificate storage.

Good enough to move on: you can serve a site and proxy an API with automatic TLS in a Caddyfile of under ten lines.

Key concepts

  • Caddyfile syntax
  • Automatic HTTPS
  • reverse_proxy and load balancing
  • JSON config and admin API
  • xcaddy plugins

Other options for this step

  • Nginx: The most widely deployed web server and reverse proxy; learn its config model and the handful of directives that cover most real setups.
  • HAProxy: A high-performance TCP and HTTP load balancer known for reliability, fine-grained health checks and detailed stats.
  • Apache HTTP Server: The long-standing web server still common in legacy stacks, shared hosting and PHP applications.

Mini project

Deploy two small services on one VM behind Caddy with separate subdomains, automatic certificates, and gzip compression, all in a single Caddyfile checked into git.

Check yourself

What must be true about your DNS and firewall for Caddy's automatic HTTPS to succeed on first start?

Free resources