Introduction

What is the first thing comes into your mind when you want to explore something? The first thing we do is take out a smart phone from your pocket and search on the internet. Irrespective of business size, the easiest way to reach out to the customers is the internet. It’s not limited only for business. Internet is the primary channel to explain to others about your innovation and experience. Internet helps you to access the contents around the clock with cost effective and convenient way.

Getting into the internet is very simple. Technically, what all you need is a domain and web pages. There are lots of internet domain providers in the market. I did my domain registration through godaddy. You can choose the domain providers as you like. Choose the domain provider and register a domain.

Once you register the domain you need web pages to reach your contents. These contents could be a plain text, images, music files, videos and etc. If you know the HTML, CSS and JavaScript you can design the web pages or else you can hire someone to design or get free web templates from the internet. Once your web page is ready, you need to seek for web hosting. Like domain name providers, there are lot of hosting providers in the market. The majority of the domain providers will provide hosting as well, but you need to pay money for that. Before choosing the web hosting providers, we need to see if they provide the infrastructure which suits for our web page. For example, if you are planning to have a business transaction or dynamic web pages you need the right software installed on your web hosting servers.

If you are planning to have a standard or static contents of your web pages and don’t need any special software (called static web hosting) there are lot providers who gives web hosting for cheaper price. For example, Amazon S3 static web hosting. Now, we don't need to spend any money for this. Yes, we can have a web hosting in Github without paying a single penny. This is very useful for the people who want to have a web site with static web pages like having company profile, business brochure, blog or personal profile. Use below steps to create a page in Github and map to your domain.

Create a page in Github

The first step to host the web page in github is creating a page. Follow steps mentioned in github page to create a page. Don’t forget to create your repo with .github.io suffix. For example, if you want to create a repository something, like techjira then use name as techjira.github.io. if you don’t give this suffix, it will still work, but the default page will be rendered from README.md file. If you give a suffix, it will pick index.html as a default page.

Github configuration

There is a good documentation available in github with the instructions to use a custom URL with Github pages, but you need to go through multiple links to achieve this. Use below steps to add your domain into github.

  1. Login into Github. Select your page repository from Your repositories list and click on Settings

  2. Scroll down until you see Github pages. If you already not yet enabled the page, select the branch to keep your web pages and click on the Save button.
  3. Once you have enabled the page option, give the domain name and click on the Save button. You will see a success message with your website name. The moment you save domain, Github will add a file called a CNAME in your repository.

    CNAME file looks like below
            www.techjira.com
        

Once you are done with Github configuration go to DNS configuration.

DNS configuration

To configure your domain with Github, you should know how to add DNS records with the DNS provider. If you don’t know how to do it, contact your domain provider. Most of the domain providers will have a web page to manage your DNS records online. Here, I am using godaddy DNS page to give the explanation. There are two different types of domains i.e., sub domain and apex domain. Sub domain usually comes with www. For example www.techjira.com is a sub domain. Apex domain doesn’t have www. For example http://techjira.com is an apex domain. DNS configuration is different for sub domains and apex.

  1. First login into DNS provider website and go to DNS setting
  2. Remove all the entries if you have any. Make sure you don’t have A records or CNAME records
  3. If you are using sub domain(WWW) add an entry of CNAME with value as YOUR-GITHUB-USERNAME.github.io. for example, if you have a github user as “test” and then the entry should be test.gitgub.io
  4. If you have apex domain, then add an entry of A with the IP address of 192.30.252.153 or 192.30.252.154
  5. If you have both sub domain and apex, then you need both entries. Sample records look like below with godady provider

That's all. You are done with your hosting. Once your configuration is done, access your website from a browser. Please note that some DNS providers will take up to 1 day to refresh your records. If you want to verify the configuration is done correctly or not not use below steps to verify.

Verify configuration

You can verify the configuration in multiple ways. One easiest way is checking online. Go to online dig tool and click on A OR CNAME to verify your records. It should be something like below.

Custom error page

If you would like to create your own custom error page HTTP error 404, create 404.html file in root folder of your page repository

Comments