How to Host your Static Website on GitHub Using your Custom Domain Name
Beatrice Wambui Mbugua Portfolio- beatricewambuimbugua.com

How to Host your Static Website on GitHub Using your Custom Domain Name

Recently, I created my static portfolio website. At first, I was conflicted on where to host it regardless of Github providing the generic option of hosting it using the github.io option. After purchasing the domain name, I wanted a hosting provider that was not expensive or complicated. During my research, I stumbled upon hosting your static website using Github, but now with a domain name.

Where to start?

First, you need to push your code to Github using the git process. Second, you need to publish the gh-pages. Afterwards, you will need to follow specific steps and they are as easy as ABCD.

No alt text provided for this image

  1. Go to your working repository, and click on the settings. You will see a page similar to the one shown above and click on pages.

No alt text provided for this image

2. This is how your pages will look like. Remember this is enabled by the gh-pages. Your site will have been published at github.io, the default domain. Therefore, you will add your custom domain in the under the custom domain option. However, you will notice the HTTPS will not be enforced.

No alt text provided for this image

3. Head to your Domain provider and add the CNAME record. The CNAME record redirects the github.io to your custom domain. For instance, if your want your site name to be www.example.com, create a CNAME record that points www.example.com to <user>.github.io.

4. To enforce the HTTPS, select?Enforce HTTPS. It can take up to 24 hours before this option is available.

No alt text provided for this image

5. Once that is set, redirect your website to point to the Github IP Addresses. Therefore for this, add the Alias as shown above through feeding the following IP address.


To create?A?records, point your apex domain to the IP addresses for GitHub Pages

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153.        

6. To confirm whether your DNS record configured correctly, use the?dig?command, replacing?EXAMPLE.COM?with your apex domain. Confirm that the results match the IP addresses for GitHub Pages above.


For?A?records
$ dig EXAMPLE.COM +noall +answer -t A
> EXAMPLE.COM     3600    IN A     185.199.108.153
> EXAMPLE.COM     3600    IN A     185.199.109.153
> EXAMPLE.COM     3600    IN A     185.199.110.153
> EXAMPLE.COM     3600    IN A     185.199.111.153.        

7. In the end, your pages setting in Github will be looking as such:

No alt text provided for this image

8. And you can launch you website having hosted on Github for free.

beatricewambuimbugua.com

The hosting is absolutely free and the process takes less than 10 minutes while following the right instructions. All the best.


Maurice Nyanja

Blockchain Engineer

3 年

Short and easy to follow good work

回复

要查看或添加评论,请登录

Beatrice Wambui Mbugua的更多文章

  • Building a Startup Website in 24 Hours: From Design to Deployment with Next.js & Tailwind CSS.

    Building a Startup Website in 24 Hours: From Design to Deployment with Next.js & Tailwind CSS.

    When innovation calls, even on a Sunday, you answer. Recently, a client reached out with an urgent need for a website…

    15 条评论
  • ?? The foundation of NEXT.js: <title>Understanding HTML <title/>

    ?? The foundation of NEXT.js: <title>Understanding HTML <title/>

    At the end of last year, I took an interest in relearning HTML. Most people underestimate the power of such a primary…

    9 条评论
  • My GDG Devfest Experience

    My GDG Devfest Experience

    It is officially one day after the biggest tech event in Kenya and probably Africa, GDG #devfest2022. Someone requested…

    5 条评论
  • How I Started my Software Development Journey

    How I Started my Software Development Journey

    Let me start with the cliché: "So many people have asked me how I started my tech journey regardless of my…

    18 条评论
  • I forgive you dad, but why?

    I forgive you dad, but why?

    So I was watching the Interview involving Wendy Waeni, Leyla Mohammed and Ellyanne Wanjiku on #JKLLive. Brilliant…

    1 条评论
  • Feeling Stuck... but you won't open it!!

    Feeling Stuck... but you won't open it!!

    Since the start of this year, I have felt stuck in life. The feeling has originated from where I am in life especially…

  • Energies

    Energies

    Have you ever noticed most people in your circle never share your posts no matter how sensible they are? Or is it me?…

    2 条评论
  • Drawing hope from Disabled Children: M.A.C.S first edition

    Drawing hope from Disabled Children: M.A.C.S first edition

    I recall that day perfectly. The day that I joined Make a Child Smile Kenya for the first time in their charity event.

    7 条评论
  • Please Listen, I just want a Decent Job because of my son.

    Please Listen, I just want a Decent Job because of my son.

    You want me to lie and say it is all perfect? Guess what; my life was never perfect. I do not even think it will ever…

    39 条评论
  • Huush, Am back and still looking for a job

    Huush, Am back and still looking for a job

    As a graduate in BSc. Disaster Preparedness and Environmental Technology, every day I log into LinkedIn jobs and…

    25 条评论

社区洞察

其他会员也浏览了