Free Web Hosting with Github Pages with Free SSL certificate

I have an app, Bongstick and recently I planned to make a website for it. As planned, I purchased the domain name bongstick.com. Now I need to build a website and host it somewhere. My blog shuvankar.com is hosted in GoDaddy shared hosting service. I was looking for a free and reliable hosting service. After some search, I came to know about Github Pages. Here I can host a static webpage and load it from a custom domain. Let me share how I have set up one.

First It needs to create a repository on Github. Make sure the repo is public, otherwise you cannot use it as Github Page as a free service. Add some website source code to that. I am not going into detail about how to push code on Github. It’s very easy and there are a lot of tutorials available for that. Goto Settings -> Pages -> Select Branch as master -> Save. The page will be published in a URL (e.g. https://sonu041.github.io/bongstick.com/)

In the custom domain enter the domain name you have. For me, I entered bongstick.com

Now your DNS needs to know, that the hostname should resolve the Github page. There is a dedicated GitHub help page for configuring the apex domain but still let me tell in short what I have done in GoDaddy. Log in to the GoDaddy console. Click on triple-dot of domain name -> DNS Management. Add below A DNS Records.

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

After some time you can see your custom domain is resolving the Github Pages content. This will work only for a static page. Github Page is not supporting any server side code. So consider the use case before trying this.

Now our website is ready and we need an SSL certificate. There are multiple free SSL certificate providers like letsencrypt, sslforfree, zerossl, etc but everyone has some disadvantages like it’s free for a very limited period and you need to renew frequently. Some have a limited number of certificates per account. My favorite is Cloudflare. Apart from Free SSL, it has some other good features as well. Let’s see how to configure it.

First login to Cloudflare. Add a site. First, you need to change the nameserver of your domain so that every request goes via Cloudflare. Go to GoDaddy DNS Management console (same screen as above)

Change the name server to that is provided by Cloudflare.

As the nameserver changed, the GoDaddy A DNS records have no value. We need to add A DNS records in Cloudflare. You may think when it is not in use why I mentioned GoDaddy configuration. It’s just for knowledge purposes only. If you don’t need an SSL certificate then configuration in GoDaddy is enough.

Go to the Cloudflare DNS tab and make sure the below A-type entries are made. In A DNS record name, enter @ for root (bongstick.com).

Go to the Github page and check Enforces HTTPS. It will take some time to reflect on the changes. Be patient and try after some time if the intended result doesn’t come immediately.

In Cloudflare, you can see that a managed edge certificate is created.

If you have a server and want to install Origin Certificates on the origin server that can be done as well.

A lot of features are available in Cloudflare. Explore the Cloudflare console and experiment with it 🙂 .

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.