MirrorNest
← Tutte le guide

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.

Sistema: Ubuntu 22.04 LTS / 24.04 LTS, or any Docker hostWeb ServerCMSSito ufficiale ↗Documentazione ufficiale ↗
Questa guida è redatta a partire dalla documentazione ufficiale di Caddy for static sites, linkata sopra — verifica sempre lì i nomi esatti di pacchetti/versioni prima di eseguire questi comandi su un server di produzione, poiché le versioni della distribuzione e del progetto cambiano nel tempo.
  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.