MirrorNest
← All guides

Caddy for static sites

A free, open-source web server that issues and renews HTTPS certificates automatically with zero configuration -- the simplest way to serve a static site or reverse-proxy an app with real TLS.

Target: Ubuntu 22.04 LTS / 24.04 LTS, or any Docker hostWeb ServerCMSOfficial homepage ↗Official docs ↗
This guide is synthesized from Caddy for static sites's own official documentation, linked above — always cross-check exact package/version names there before running these commands on a production server, since distro and project versions move over time.
  1. 1Install Caddy

    sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
    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
  2. 2Point your domain's DNS at this server first

    Caddy requests a Let's Encrypt certificate automatically the first time it serves your domain -- DNS must already resolve to this server's IP before that step succeeds.

  3. 3Configure the Caddyfile

    sudo tee /etc/caddy/Caddyfile <<'EOF' example.com { root * /var/www/example.com file_server } EOF
    sudo mkdir -p /var/www/example.com
    sudo systemctl reload caddy

    Replace example.com with your real domain -- Caddy fetches and renews the HTTPS certificate for it automatically, no Certbot needed.