Host a Static Site with Caddy and Automatic HTTPS
Caddy is a web server that gets and renews HTTPS certificates automatically. For a static site — a portfolio, docs, a landing page — it's the shortest path from files to a live, secure website.
1. Point your domain
Create an A record for your domain pointing to the server's IPv4. Caddy needs it to resolve before it can get a certificate.
2. Install Caddy
On Debian or Ubuntu, add the official repository and install:
apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' > /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install -y caddy
3. Upload your site
Put your files in /var/www/site — from your computer:
rsync -av --delete ./public/ root@YOUR_SERVER_IP:/var/www/site/
4. Configure
Replace /etc/caddy/Caddyfile with:
example.com, www.example.com {
root * /var/www/site
file_server
encode gzip zstd
}
systemctl reload caddy
That's it. Within seconds Caddy has a certificate, redirects HTTP to HTTPS and serves your site compressed.
Open the ports
If you use UFW:
ufw allow 80/tcp
ufw allow 443/tcp
Deploying updates
Run the same rsync command after each build — no restart needed.
How small can it be?
A static site is about the lightest thing a server can do. Atom serves a lot of visitors.
Deploy a server and put your site online in minutes.