β Back to Blog
How to Configure a .com.np Domain with GitHub Pages and Cloudflare
Posted May 7, 2025
How to Configure a .com.np Domain with a GitHub Pages Site Using Cloudflare
Setting up a .com.np domain to work with GitHub Pages via Cloudflare gives you free hosting, HTTPS, caching, and DDoS protection. Here's a complete guide to get you started.
π οΈ Prerequisites
- A registered
.com.np domain from register.com.np
- A GitHub repository with your site set up for GitHub Pages
- A Cloudflare account signup here
Step 1: Set Up Your GitHub Pages Site
- Create a repository and push your site files (HTML, CSS, JS).
- Go to Settings > Pages.
- Set:
- Source: Deploy from a branch
- Branch: main (or your default)
- Folder: /root or /docs
- Save. Your site will be available at:
https://yourusername.github.io/your-repo-name/
Step 2: Get Your .com.np Domain Ready
- Register the domain at register.com.np.
- Upload scanned documents (e.g., citizenship).
- Skip nameservers for now if unsure.
- Once approved, log in and prepare to set Cloudflare nameservers (Step 4).
Step 3: Add Your Domain to Cloudflare
- Log in to Cloudflare Dashboard.
- Click Add a Site and enter your domain.
- Select the Free Plan.
- Cloudflare scans for existing records (you can skip).
- Note the Cloudflare nameservers provided (e.g.):
lola.ns.cloudflare.com
yichun.ns.cloudflare.com
- Go back to register.com.np and update your domain's nameservers.
Step 4: Configure DNS on Cloudflare
Go to the DNS tab of your Cloudflare dashboard and add these:
β
Root Domain (yourdomain.com.np)
Add four A records:
Type: A
Name: @
IPv4: 185.199.108.153
Proxy: Proxied
... (also add)
185.199.109.153
185.199.110.153
185.199.111.153
β
www Subdomain
Type: CNAME
Name: www
Target: yourusername.github.io
Proxy: Proxied
Step 5: Configure Your GitHub Repo for the Custom Domain
- Go to Settings > Pages in your repo.
- Under Custom Domain, enter:
yourdomain.com.np
- GitHub auto-creates a
CNAME file, or you can manually add it:
yourdomain.com.np
Step 6: Force HTTPS with Cloudflare
- Go to the SSL/TLS tab.
- Set SSL mode to Full or Full (strict).
- Enable:
- Always Use HTTPS
- Automatic HTTPS Rewrites
π Optional: Redirect www to non-www (or vice versa)
In Cloudflareβs Page Rules, create a rule:
If URL matches: www.yourdomain.com.np/*
Forwarding URL (301): https://yourdomain.com.np/$1
β
Test Your Site
- Visit
https://yourdomain.com.np
- You should see your GitHub Pages site with HTTPS
π Troubleshooting Tips
- DNS propagation may take up to 24β48 hours
- Clear cache in Cloudflare and your browser
- Ensure the
CNAME file is present in your repo
- Switch SSL mode if you face certificate issues
π Conclusion
Congratulations! You've successfully configured your free .com.np domain to work with GitHub Pages using Cloudflare. Enjoy the benefits of secure, fast, and free website hosting.