jhampton.io: one home domain, an index, and a wildcard certificate
jhampton.iosubdomainswildcard-dnswildcard-certificatecertbotdns-01linodenginxredirectsindex
By late October 2026 Justin had about 45 URLs across 8 domains, plus apps living at paths on unrelated sites (jhampton.io/cal, justinahampton.com/encyclopedia, tldrcom.com/spectre). Finding anything meant remembering where it had happened to land. The fix was two things that support each other: a naming convention so most URLs can be guessed, and an index generated from a registry so the rest can be found.
The convention
- Tools and apps live at
<name>.jhampton.io, where<name>is the repo name in~/dev/<name>. Where a shorter name reads better (cal,wiki), the repo name also works and 301s to it (calendar.jhampton.io→cal.jhampton.io,encyclopedia.jhampton.io→wiki.jhampton.io). - An app's API lives at
/apion its own subdomain: one vhost, one certificate, no CORS. - Android apps keep publishing through apps.jhampton.io and its F-Droid repo (A self-hosted F-Droid repository and APK catalog); that URL never moves, because installed updaters read it.
- Branded sites (TLDR, client and family sites) keep their own domains. justinahampton.com stays the public personal site (justinahampton.com and its subdomains).
- A moved URL gets a permanent 301 to the same path on the new host, for good. The one exception was umlol, moved the same day it first shipped, with no redirect by request.
Moved on 2026-10-30: jhampton.io/cal → cal.jhampton.io, justinahampton.com/encyclopedia → wiki.jhampton.io, 3d.justinahampton.com → 3d.jhampton.io, videos.justinahampton.com → videos.jhampton.io (videos.jhampton.io (private video site architecture)), tldrcom.com/spectre → spectre.jhampton.io, and justinahampton.com/fun/experiments/umlol → umlol.jhampton.io.
The index
https://jhampton.io/ is generated from one registry file, ~/dev/hub/sites.json (name, URL, description, tags, repo, deploy command, server path, data folder, planned move, public or private). Type to filter; Enter opens the top match. Public entries show to everyone. A passcode (bcrypt hash plus an HMAC-signed 30-day cookie, with a per-IP throttle) unlocks the private entries and every entry's ops details. A cron job on the server requests every URL every 10 minutes and shows a green or red dot; any HTTP answer below 500 counts as up, because an API root's 404 or a login page's 401 still means the site is serving.
The registry only stays true if updating it is part of shipping, so the rule is: anything that goes live or moves gets its sites.json entry in the same change.
Wildcard DNS needs a catch-all first
A * A/AAAA record makes every name under the domain resolve to the server. nginx then picks a server block by name, and for a name it doesn't know it falls back to the first block loaded, certificate and all. On this server that was 3d.justinahampton.com, so every typo'd subdomain showed the 3D site behind a certificate warning. Add a catch-all before (or right after) the record:
server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 444; }
server { listen 443 ssl default_server; listen [::]:443 ssl default_server; server_name _; ssl_reject_handshake on; }
ssl_reject_handshake (nginx 1.19.4+) refuses the TLS handshake, so no certificate is shown at all. Exact server_names always win over a *.domain block, which always wins over the default, so a *.jhampton.io block can send unknown names to the index without touching named sites.
The wildcard certificate (DNS-01 on Linode)
Let's Encrypt only issues wildcards over DNS-01, which means certbot must write TXT records itself. With DNS on Linode: install python3-certbot-dns-linode (EPEL), create a Personal Access Token with Domains: Read/Write only (Linode can't limit it to one domain) and no expiry (renewal needs it), store it root-only, then:
certbot certonly --dns-linode --dns-linode-credentials /root/.secrets/certbot-linode.ini \
--dns-linode-propagation-seconds 180 --cert-name wildcard.jhampton.io -d '*.jhampton.io' -d jhampton.io
certonly with a DNS plugin does not reload nginx on renewal; add a deploy hook (/etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh) or the renewed certificate is never served. Confirm with certbot renew --cert-name … --dry-run. A new <name>.jhampton.io site then needs no certbot run: its nginx block points at /etc/letsencrypt/live/wildcard.jhampton.io/.
Moving a host without breaking it
- Keep the old certificate renewing. The old host's 301 needs valid HTTPS to be reachable at all. Put the redirect inside
location / { return 301 …; }rather than at server level, so certbot's injected/.well-known/acme-challengelocation still answers (renewal dry run passed after the move). - Origins change, so per-origin state resets: sessions and cookies (sign in again), localStorage, service workers, and any bucket CORS policy (the videos bucket needed
videos.jhampton.ioadded; see Linode (Akamai) Object Storage). - Apps with baked-in URLs need a release: Calendar (share API + App Links host), the encyclopedia app (its mirrored base URL, see Keeping a web app and an Android app identical without a framework) and Spectre (its updater). Old installed copies keep working through the 301s, because Java's
HttpURLConnectionfollows same-protocol redirects, but App Links only verify the host the app declares. - Install configs under the names they replace. A redirect config installed under a new filename left the original block loaded too; nginx warned "conflicting server name … ignored" and kept serving the old one. Read
nginx -twarnings, not just its exit status. - Back up
/etc/httpd/conf.dand/etc/nginx/conf.dbefore a batch change, and gate the reloads onapachectl configtest && nginx -t.