DEV Community

loading...

Hosting a custom domain on Github

vjnvisakh profile image Visakh Vijayan ・2 min read

So we have all been there where we want to make a static website and are confused as to where to buy them from. Usually, it involves two steps -

  1. Where to get the domain name from.
  2. Where to get the hosting from.

Although there are a lot of competitors in the market choosing the best one becomes again a headache.

But the real question is Do you even need it

In today's world ... and by this, I mean the Internet world, everything is cheap you just have to find the correct shop that is giving it out.

Domain names

  1. Head over to freenom. A place which gives out free domain names.
  2. Nextraone is also a fair price website which I use to buy domain names.
  3. And then there is Godaddy like always.

Free hosting

  1. Sites like Freehosting.com or Hostinger.com.
  2. Github Pages etc.

Here is what I did to host my small website

  1. I bought a domain name from Godaddy called vjnvisakh.info. There is nothing on the site as of now though. :)

  2. Then I created a repository on Github.

  3. Added by index.html file into the repo and pushed it to the repo.

  4. Added a CNAME file containing just my domain name.

  5. Went to Godaddy and updated the DNS settings for the website as in the picture below.

  6. Went to the Github repository(web-version) and created a Github Page using the master branch.

  7. And Voila! the site was updated.

Of course, don't expect to run full-fledged PHP sites via this. But for static websites, it's an easy and cheap way of doing it.

Discussion (6)

pic
Editor guide
Collapse
tadman profile image
Scott Tadman • Edited

It's really hard to understate the importance of having full control over the domain you use to promote yourself and host your content. If GitHub pages works today that's great, but if you find something better in the future you'll be able to move at will, without breaking any links.

This is not possible if you're using Medium or some other blogging platform that forces their name into the URL. They'll own that content forever, and you won't.

GitHub Pages is a fantastic hosting platform and when combined with Jekyll you can actually create a lot of rich content with git and a smidge of Ruby.

Collapse
mondal10 profile image
Amit Mondal

Thank you, that was really helpful. I just wanted to add something that we also need to navigate to our DNS provider and create a CNAME record that points the subdomain to the default domain for our site. Steps are documented on GitHub as well.

Collapse
amitgoyal360 profile image
Collapse
vjnvisakh profile image
Collapse
xplormedia profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
XplorMedia

Nice post and I really appreciate it. By the way, I have posted an article related to hosting comparison where we have mentioned your post dev.to/xplormedia/altushost-vs-hos...