A static site — HTML, CSS, JS, images — is the smallest possible web presence, and hosting it yourself on Linux is a rite of passage: one machine, one web server, one DNS record, certificates included. This is the whole stack, end to end.

The pieces #

The complete dependency chain
build -> files on the server -> web server -> DNS -> TLS -> visitor

Nothing here is optional: the files must exist, the server must serve them, DNS must point at the machine, and TLS must cover the name. Each layer has its own failure mode, and knowing the order is the debugging method.

Layer by layer #

The files. However produced — a static generator, a build step in CI, or hand-written — the output lands in one directory:

The deploy is a file sync
$ rsync -av --delete dist/ deploy@server:/srv/aospix/public/

rsync sends only changes; --delete keeps the target an exact mirror. This one line, run from a deploy script, is the deployment pipeline.

The server. The minimal choices, both covered in this series:

Caddy — two lines, TLS included
aospix.com {
    root * /srv/aospix/public
    file_server
}

Or nginx with a root and file_server equivalent, plus certbot for certificates. Caddy for the shortest path, nginx when the setup will grow into proxying apps.

DNS. An A record (or AAAA, or CNAME at a CDN) pointing the name at the machine's IP — dig aospix.com +short verifies what the world sees. TTL awareness matters on cutover day: lower it beforehand, and remember resolvers cache.

TLS. certbot or Caddy's automation — the certificate must cover exactly the names in DNS.

The checklist that catches everything #

CheckCommand
Files present on serverssh server ls /srv/aospix/public
Server answers locallycurl -I localhost on the server
Name resolves to this machinedig +short example.com
Public answer with TLScurl -sI https://example.com
Redirects and headerscurl -sI http://example.com
Firewall openUFW: 80, 443

The two-curl pattern — localhost on the server, then the public name from outside — cleanly splits "server problem" from "DNS/network problem", which is ninety percent of first-deploy debugging.

Cache headers are the free win on static hosting: Cache-Control: immutable on fingerprinted assets and a short cache on index.html give visitors instant repeat loads with correct updates. Both servers set this in one block per location.

For CDN-fronted or managed alternatives, the same files deploy to edge platforms with zero servers. The network series continues.