How to Host Your Website With a Custom Domain for Free

‌‌‌‌‌‌
The Startup
Published in
3 min readJul 25, 2020

A common misconception that many (including myself in the past) have is that you need to pay money to host a website with a custom domain. That couldn’t be further from the truth.

Hosting Your Website

So you’re satisfied with how your website looks on localhost. Now what? If you haven’t got a GitHub account, go ahead and make one. Then, create a new repository. You can choose to make it public or private.

You can give your repository any name, but conventionally for personal/portfolio websites, people name it <username>.github.io

If you are familiar with the command line and GitHub, go ahead and push your code. If not, simply click “upload an existing file”

When you upload or push your files, be sure that your index.html is in the root directory. That is, do not have it nested inside any folders. Once you have uploaded your files, go into your “Settings” tab in the repository.

If you scroll down, you’ll see a “GitHub Pages” section. Go ahead and change the source to the master branch.

Once this is done, refresh the page and you’ll see “Your site is ready to be published at *Repository URL*”. If you wait a minute or two and refresh, that message will change to “ Your site is published at *Repository URL*”. Click that link and make sure your page is up.

Getting a Custom Domain

This step is fairly easy. Head to Freenom and create an account, following the instructions. Once you have created an account, register a new domain here. Find your domain, and check out.

Make sure your domain is FREE of charges

I would suggest getting your domain for 12 months so you don’t have to re-register it for another year. When you’re checking out, it may ask you to sign in again. Do that, and find your way back to the checkout page. It should NOT ask you for any credit card details.

Once that is done, go to services -> My Domains -> Manage Domain -> Manage Freenom DNS. Add “A” records to the following domains:

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Optional: add CNAME from WWW to your custom domain. This will allow www.<yourdomain>.com to work with or without the “www”

Once that is done, go to your GitHub pages settings again, and add your custom domain under “Custom domain” and hit save.

If you get this warning, don’t worry. Give it some time and head over to our custom domain. The process can take up to 24 hours (it usually just takes a minute or two) for your domain to link to your Github pages.

Voila! Now you have your own website hosted with a custom domain, and you didn’t spend a single penny to do it. Check out the website I published in this tutorial.

Feeling stressed on LinkedIn while job hunting? Check out LinkedOut, my chrome extension that will boost your productivity and save your mental health when on LinkedIn.

--

--