Add SSL (https) to your Github Page with CloudFlare and NameCheap
I wrote these instructions assuming you have a domain set up with NameCheap. Other domain services will allow you to modify the DNS settings, but definitely go with CloudFlare for your SSL certificate since it’s free and they have a great UI and support.
Create an account with CloudFlare
- Go to cloudflare’s website and create your account
- Select the free option
- Add your site by select Add site and entering your domain
- Upon adding your site, you will receive the Cloudflare Nameservers. Save those for later as you will need to enter them into NameCheap to properly route your site.
Add CNAME and A records
After you add all of the records, you should have a 1 CNAME record and 2 A records. In my experience, CloudFlare added these records from NameCheap, but I’ve added step-by-step instructions just in case.
You will need to add a CNAME file to the root of your site with the domain. For example, my site’s CNAME just has
edcupaioli.com on the first line. That’s all you need.
- Select DNS from the top menu
- Remove whatever records exist to add the proper records
- Use the toggle to select CNAME, enter
wwwfor the name and enter your github domain (username.github.com) for the domain name, then Select Add Record.
- Even if your site is served through a subfolder (username.github.com/project), you will still enter your github domain without the path for the domain name.
- Select A on the dropdown and enter your domain name with no www or https (example.com) and
220.127.116.11for the iPv4 address
- Repeat the above but add
18.104.22.168for the iPv4 address
Add custom DNS to NameCheap
Take those nameservers from before. They are in the DNS panel in CloudFlare in case you closed the window from before.
- Log in to NameCheap, go the Ac and select manage