Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Created September 5, 2025 16:41
Show Gist options
  • Save pythoninthegrass/b57b566adabb268c859afb9e0da7cb7c to your computer and use it in GitHub Desktop.
Save pythoninthegrass/b57b566adabb268c859afb9e0da7cb7c to your computer and use it in GitHub Desktop.
# /etc/caddy/Caddyfile
{
auto_https disable_redirects
}
:80 {
respond "Hello from HTTP port 80"
}
localhost {
respond "Hello from localhost HTTPS (trusted)"
}
1.2.3.4:443 {
tls internal
respond "Hello from 1.2.3.4 HTTPS (self-signed)"
}
@pythoninthegrass
Copy link
Author

Install caddy per https://caddyserver.com/docs/install then run the following:

# copy the gist contents
sudo vim /etc/caddy/Caddyfile

# validate config
caddy validate --config /etc/caddy/Caddyfile

# install self-signed certs from caddy's internal CA
sudo caddy trust

# verify they were created
sudo find /var/lib/caddy -name "*.crt" -o -name "*.pem" 2>/dev/null

# reload caddy service
sudo systemctl reload caddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment