Disclaimer
There are many ways to host static website for free. In this guide we will use github as a hosting platform. Github can only host static websites*
Prerequisites
- Github account
- Code for your website
Main
Step 1: Click the “+” icon and click “New repository”
Step 2: Set basic info
Keep a name for your repository. Adding ‘.github.io" at the end of your repo name is important
Make sure “Add a README” file is checked
“Create repository”
Step 3: add your code
Upload your code like so
Step 4: Enabling github pages
Go to settings > Pages
Select “main” as source and “save”
Your site domain will be given
[optional] Step 5: Custom Domain
Enter your custom domain as shown and “save”
Add these DNS settings on your domain:
Type | Name | IP |
---|---|---|
A | [domain-name] | 185.199.108.153 |
A | [domain-name] | 185.199.109.153 |
A | [domain-name] | 185.199.110.153 |
A | [domain-name] | 185.199.111.153 |
CNAME | www | [github-repo-name] |
Your DNS table should look something like this:
this DNS table is for mansoor.cf with github
that’s it ✌🏽