Back to notes

Deploying a static site on a small VPS

Keep each build in a versioned directory and switch releases with a symbolic link.

Upload first, then switch

Upload the build to a new directory. Verify that the home page, 404 page, and assets are present before pointing the site at it. An interrupted upload leaves the current release available.

site/
  current -> releases/20261116-120000
  releases/
    20261116-120000/
      index.html
      404.html

Keep the previous release. Check that its files are readable, then point the site back to it. Replacing the link atomically on the same filesystem avoids a gap when the document root is missing.

Check real requests

After deployment, request the home page, an article, and a missing URL. The missing URL should show the custom error page and return HTTP 404.