Caddy
Caddy is an open-source, HTTP/2-enabled web server. It’s notable for its easy configuration, automatic HTTPS, and capability to serve static sites or reverse proxy.
Installation
Get 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
Starting Caddy Service
Check if Caddy service is running:
sudo systemctl status caddy
If it’s not running, start it:
sudo systemctl enable --now caddy
Enabling the service will start Caddy automatically when the server boots up.
Caddy Configuration
Edit the Caddyfile:
sudo micro /etc/caddy/Caddyfile
Add your site configurations:
sinpro.dev {
reverse_proxy :3001
}
talk.sinpro.dev {
reverse_proxy :3002
}
Add cache control:
sinpro.dev {
reverse_proxy :3001
@static path *.avif *.woff2 *.png
header @static Cache-Control "public, max-age=86400, must-revalidate"
}
Finally, restart the Caddy service to apply the changes:
sudo systemctl restart caddy