ruk·si

Caddy

Updated at 2022-08-17 13:29

Caddy is a web server with automatic HTTPS.

Seems cool... wouldn't use it for production though.

Install Caddy: https://caddyserver.com/docs/install Installing through the package manager also enables the related systemd service

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
# sudo apt install libnss3-tool

Create a Caddyfile to /etc/caddy/Caddyfile:

sudo install -m 0644 /dev/stdin /etc/caddy/Caddyfile <<EOF
{
    # email your-email@example.com
    auto_https off
}
:2015 {
    root * /usr/share/caddy
    file_server
}
EOF
sudo caddy fmt --overwrite /etc/caddy/Caddyfile
caddy validate --config /etc/caddy/Caddyfile
caddy run --config /etc/caddy/Caddyfile --environ
chromium http://localhost:2015/
caddy start --config /etc/caddy/Caddyfile
chromium http://localhost:2015/
caddy reload --config /etc/caddy/Caddyfile
caddy stop --config /etc/caddy/Caddyfile

systemctl start caddy
chromium http://localhost:2015/
systemctl status caddy
systemctl stop caddy

Sources

  • https://caddyserver.com/
  • https://caddyserver.com/docs/running
  • https://caddyserver.com/docs/quick-starts/https