Moving to a new machine
Applies to Method 1 (Tailscale) and Method 2 (your own cert) deployments.
certs/ is gitignored, so copying the project directory (rsync/scp/tar)
to a new host carries the old machine’s fullchain.pem/privkey.pem
along with it. nginx doesn’t check whether a cert’s subject matches
NGINX_SERVER_NAME, it just serves whatever bytes are in those two files. If
you don’t clear them, the new host will silently keep serving the old
machine’s certificate.
-
Copy the project directory to the new host by whatever means you normally would (
rsync,scp,tar). -
On the new machine, update
.env’sNGINX_SERVER_NAMEto the new host’s value. -
Delete the stale certificate files and bring the stack up:
Terminal window rm certs/fullchain.pem certs/privkey.pemdocker compose --profile tailscale up -d --build # or: up -d --build for BYO-cert (Method 2)
For Method 1, cert-renew’s tailscale cert call is a no-op renewal until
the file is near expiry, so deleting the stale files first forces a real
reissue for the new domain instead of silently keeping the old one.