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.
- Purchase the top-level domain - gandi.net is my current preferred registrar. Hopefully this will be the only cash you drop in this process.
- Create a new public repository on github.
- Clone the new repo locally and create your site content package, even starting with something as simple as a standalone
- Add a file called
CNAMEto the repo, containing only a single line with your just-purchased domain in it. e.g.
- Commit the content to github.
- In the settings –> pages menu of the repository on github.com, point to the correct branch, and enter the domain under “Custom domain”.
- On Cloudflare, select “Add a site”.
- Enter the domain, choose a free plan, and check that the detected
CNAMErecords are listed as “proxied”.
- On the registrar’s domain management console, change the default nameservers to the Cloudflare nameservers provided (e.g.
- Go to the DNS tab of the newly-added domain dashboard on Cloudflare, and change the
Arecord IP address to one of the currently-listed github IPs.
- Wait up to a day for it all to settle into place, though in practice it tends to just be a few minutes.