Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Last active September 5, 2023 01:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wboykinm/11a4c39234df27314513cdd4e7184b13 to your computer and use it in GitHub Desktop.
Save wboykinm/11a4c39234df27314513cdd4e7184b13 to your computer and use it in GitHub Desktop.

How to deploy a webpage in 2022

Instructions for getting a [mostly] static website onto a custom domain, with https encryption, for [mostly] free. I'm finally writing this down after getting stuck on step 10 way too many times. Godspeed.

  1. Purchase the top-level domain - gandi.net is my current preferred registrar. Hopefully this will be the only cash you drop in this process.
  2. Create a new public repository on github.
  3. Clone the new repo locally and create your site content package, even starting with something as simple as a standalone index.html.
  4. Add a file called CNAME to the repo, containing only a single line with your just-purchased domain in it. e.g. domain.com.
  5. Commit the content to github.
  6. In the settings --> pages menu of the repository on github.com, point to the correct branch, and enter the domain under "Custom domain".
  7. On Cloudflare, select "Add a site".
  8. Enter the domain, choose a free plan, and check that the detected A and CNAME records are listed as "proxied".
  9. On the registrar's domain management console, change the default nameservers to the Cloudflare nameservers provided (e.g. david.ns.cloudflare.com).
  10. Go to the DNS tab of the newly-added domain dashboard on Cloudflare, and change the A record IP address to one of the currently-listed github IPs.
  11. Wait up to a day for it all to settle into place, though in practice it tends to just be a few minutes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment