What is Caddy?

Caddy has a wide range of use cases including:

  • Web Server
  • Reverse Proxy
  • Sidecar Proxy
  • Load Balancer
  • API Gateway
  • Ingress Controller
  • System Manager
  • Process Supervisor
  • Task Scheduler

Today we will be installing and setting up Caddy as a Reverse Proxy. This will be on a Debian 10 system but this will also work with Ubuntu 20.04.

Install - https://caddyserver.com/docs/download

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \
| sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
  1. sudo apt update
  2. sudo apt install caddy

Check status: systemctl status caddy
You should see something similar to this:

● caddy.service - Caddy
   Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-11-15 20:00:00 UTC; 2min 35s ago
     Docs: https://caddyserver.com/docs/
 Main PID: 4028 (caddy)
    Tasks: 7 (limit: 1167)
   Memory: 15.5M
   CGroup: /system.slice/caddy.service
           └─4028 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
  1. Now head to your server's IP e.g.
    You should see:

Reverse Proxy Setup

  1. Create Caddyfile in the current working directory

Use the following template:

example.com {
  1. Restart Caddy and adopt the new config
    caddy reload

Once the new config is loaded, a Let's Encrypt HTTPS certificate is automatically generated for the domain. Just make sure the A record points to the Caddy server!

Additional Settings

  • Load Balancing
  • Active Health Checks
  • Passive Health Checks
  • Streaming
  • Header Manipulation
  • Transport

Syntax for the features above: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy

That's it!
Now grab a coffee ☕️