← 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

Step 1: Set Up Your GitHub Pages Site

  1. Create a repository and push your site files (HTML, CSS, JS).
  2. Go to Settings > Pages.
  3. Set:
  4. Save. Your site will be available at:
    https://yourusername.github.io/your-repo-name/

Step 2: Get Your .com.np Domain Ready

  1. Register the domain at register.com.np.
  2. Upload scanned documents (e.g., citizenship).
  3. Skip nameservers for now if unsure.
  4. Once approved, log in and prepare to set Cloudflare nameservers (Step 4).

Step 3: Add Your Domain to Cloudflare

  1. Log in to Cloudflare Dashboard.
  2. Click Add a Site and enter your domain.
  3. Select the Free Plan.
  4. Cloudflare scans for existing records (you can skip).
  5. Note the Cloudflare nameservers provided (e.g.):
    lola.ns.cloudflare.com
    yichun.ns.cloudflare.com
          
  6. 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

  1. Go to Settings > Pages in your repo.
  2. Under Custom Domain, enter:
    yourdomain.com.np
  3. GitHub auto-creates a CNAME file, or you can manually add it:
    yourdomain.com.np

Step 6: Force HTTPS with Cloudflare

  1. Go to the SSL/TLS tab.
  2. Set SSL mode to Full or Full (strict).
  3. Enable:

πŸ”„ 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

πŸ“Œ Troubleshooting Tips

πŸš€ 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.