Configuring Caddy for HTTPS

Caddy can automatically provision and renew TLS certificates. Here’s a basic Caddyfile configuration:

{
  email your-email@example.com
}

helix.yourdomain.com {
  reverse_proxy localhost:8080
}

Installation

Install Caddy on Ubuntu:

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

Configuration

  1. Edit the Caddyfile:

    sudo nano /etc/caddy/Caddyfile
    
  2. Replace the contents with your configuration

  3. Restart Caddy:

    sudo systemctl restart caddy
    

Caddy will automatically obtain and renew certificates from Let’s Encrypt.