How to host a website for free

Published: July 3, 2020
Anthony
By Anthony
3 min read
How to host a website for free

I recently started my own blog site. It was super simple to make and cost me almost nothing. I’ll be teaching you guys step by step how you can set up your own website as well.

Set up a Github pages

You’ll need a basic level of programming in order to do this, but don’t worry, I’ll guide you through it. First create an account on Github if you don’t have one already.

After setting up your account, follow the steps listed in Github Pages.

  1. Create a public repository. The repo must have the same name as your github username.
Repo
  1. Download Github Desktop

This will help you pushing your code to the repository.

  1. Clone the repository

Click the "Set up in Desktop" button. When the GitHub desktop app opens, save the project.

  1. Create an index.html inside that cloned folder.

Here’s a sample index.html file you can copy.

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Mai’s site</title>
  <meta name="description" content="Your first website">
  <meta name="author" content="Mai">
</head>

<body>
    <h1>Hello World</h1>
</body>
</html>
  1. Commit & publish

Enter the repository, commit your changes, and press the publish button.

  1. View your website!

It will take a couple of seconds before your site is live. You can find it at https://username.github.io. For example, you can find mine at xonew1ng3dang3lx.github.io.

Acquiring your very own domain name

This step is totally optional if you’re okay with using the URL provided by Github Pages. However, that URL is not exactly the most memorable URL, but thankfully you can purchase your own domain name to change it. I purchased mine for $1 at Go Daddy.

  1. Decide what domain name you would like to use

This is honestly the hardest part. Some domains can range from $1 to thousands depending on the popularity.

  1. Configure the DNS

Next we'll need to point your newly acquired domain name to your site hosted on Github Pages.

  • In the Type "A" row update the IP address to: 185.199.108.153
  • In the CNAME row with Name "www" input your Github Pages website (username.github.io)
  • At the bottom click the "ADD" button and make 3 more Type "A" rows with the IP addresses of: 185.199.109.153, 185.199.110.153, 185.199.111.153

It will look something like this afterwards.

DNS
  1. Push a CNAME file in your repository
CNAME
  1. Enable HTTPS in your Github settings

If you don't enable HTTPS, Chrome may consider your site as insecure. In order to make it secure, head over to your repository's settings and toggle on "Enforce HTTPS".

HTTPS

Free Image Hosting

You can either check in your images directly to your Github repository or you can host them somewhere else. I’m using Imgur since they won’t delete any uploaded images if they’re uploaded from an account. Check out this link to customize the size of the images as well.

Related Posts

Copyright 2020 © Mai Nguyen. All rights reserved.