Skip to main content

Caddy Setup Guide

Caddy is the primary web server and reverse proxy for the network. It handles TLS termination (often using DNS challenges for internal domains) and routes traffic to backend services.

Installation

Standard Install (Debian)

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

Custom Build (with xcaddy)

To support features like specific DNS providers (e.g., Porkbun, Cloudflare) or custom modules, Caddy is built using xcaddy.

  1. Install Go: Check go.dev for the latest version.

    wget https://go.dev/dl/go1.24.4.linux-amd64.tar.gz
    sudo rm -rf /usr/local/go
    sudo tar -C /usr/local -xzf go1.24.4.linux-amd64.tar.gz
    echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
    source ~/.profile
  2. Install xcaddy:

    go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
  3. Build Caddy: Replace github.com/caddyserver/replace-response with your required modules.

    xcaddy build --with github.com/caddyserver/replace-response
  4. Replace Binary:

    sudo systemctl stop caddy
    sudo mv ./caddy /usr/bin/caddy
    sudo systemctl start caddy

Service Management

  • Status: sudo systemctl status caddy
  • Restart: sudo systemctl restart caddy
  • Logs: sudo journalctl -u caddy (or -fu caddy for live tail)

Configuration

The main configuration file is located at /etc/caddy/Caddyfile. See Caddy Configuration for details on the specific sites and blocks used.