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
index.html
. - Add a file called
CNAME
to the repo, containing only a single line with your just-purchased domain in it. e.g.domain.com
. - 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
A
andCNAME
records are listed as “proxied”. - On the registrar’s domain management console, change the default nameservers to the Cloudflare nameservers provided (e.g.
david.ns.cloudflare.com
). - 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. - Wait up to a day for it all to settle into place, though in practice it tends to just be a few minutes.