πŸ“˜ How to Configure GitHub Pages with a Custom Domain (Using Cloudflare + GoDaddy)

A complete beginner-friendly, depth guide for DevOps engineers


🧭 1. Why We Are Doing This

GitHub Pages allows you to host:

  • Project documentation
  • Static websites
  • MkDocs / Docusaurus sites
  • API docs
  • Portfolio pages

By default, GitHub hosts your site at:

https://<username>.github.io/<repository>

But this URL:

  • Looks unprofessional
  • Is hard to remember
  • Does not match your personal brand

So we configure a custom domain, such as:

https://debugbox.ibtisam-iq.com

This gives you:

  • Full branding
  • Professional OSS style
  • SEO benefits
  • A consistent identity across all tools

You can repeat this process for ANY number of projects.


🌍 2. Understanding the Domain Roles (GoDaddy vs. Cloudflare)

This is the MOST important concept.

βœ” GoDaddy = Registrar

You ONLY bought the domain here. It does not control DNS anymore.

βœ” Cloudflare = DNS Manager

You moved your nameservers to Cloudflare. This means all DNS changes must happen in Cloudflare.

❌ Do NOT edit DNS in GoDaddy now.

It will do nothing because GoDaddy DNS is bypassed.

This confusion is very common β€” but now you understand it perfectly.


🌐 3. What We Want to Achieve

Our goal:

Create a custom domain for our GitHub Pages site:

debugbox.ibtisam-iq.com

Which points to:

ibtisam-iq.github.io

So when someone opens:

debugbox.ibtisam-iq.com

GitHub Pages serves your MkDocs site.


🧩 4. Requirements Before Starting

  • You purchased a domain (ibtisam-iq.com)
  • You changed nameservers to Cloudflare (already done)
  • You enabled GitHub Pages in your repo
  • You deployed a MkDocs or static site
  • You enabled SSL (HTTPS)

You already completed everything β€” now we document it.


🧱 5. Step-by-Step Setup

Step 1 β€” Add a DNS Record in Cloudflare

Go to:

Cloudflare β†’ DNS β†’ Records β†’ Add Record

Add this EXACT entry:

Type:   CNAME
Name:   debugbox
Target: ibtisam-iq.github.io
TTL:    Auto
Proxy:  OFF  (must be DNS only)

❗ VERY IMPORTANT:

The orange cloud must be disabled.

Use Gray Cloud β†’ DNS Only, because GitHub Pages cannot work behind Cloudflare proxy.


Step 2 β€” Tell GitHub Pages about Your Domain

Go to:

GitHub Repo β†’ Settings β†’ Pages

Under Custom Domain enter:

debugbox.ibtisam-iq.com

GitHub will:

  • Verify DNS
  • Create a CNAME file during deployment
  • Link your repo to the domain
  • Enable HTTPS

If verification fails, wait 2–10 minutes.


Step 3 β€” Update Your GitHub Actions Deployment

Inside:

.github/workflows/docs-build.yml

Add:

cname: debugbox.ibtisam-iq.com

This ensures GitHub Pages always creates the correct CNAME file.


Step 4 β€” Set the Correct Site URL in mkdocs.yml

Edit:

mkdocs.yml

Add:

site_url: https://debugbox.ibtisam-iq.com

This helps with:

  • Sitemap
  • Canonical URLs
  • SEO correctness

Step 5 β€” Cloudflare SSL Settings

Go to:

Cloudflare β†’ SSL/TLS

Set:

βœ” SSL Mode: Full

Not Flexible.

Then enable:

  • Always Use HTTPS β†’ ON
  • Automatic HTTPS Rewrites β†’ ON
  • Opportunistic Encryption β†’ ON
  • TLS 1.3 β†’ ON

This ensures your site always loads securely.


🎯 6. Confirming Everything Works

Use the following commands:

Check DNS propagation:

dig debugbox.ibtisam-iq.com

You must see:

debugbox.ibtisam-iq.com CNAME ibtisam-iq.github.io

Test in browser:

Open:

https://debugbox.ibtisam-iq.com

You should see:

  • GitHub Pages
  • Or your MkDocs site
  • With valid HTTPS

If you see a 404 GitHub Pages not found, it means:

  • DNS is correct
  • HTTPS is correct
  • GitHub Pages is configured
  • Your repo has no index.html yet OR build hasn’t deployed yet

This is normal if CI hasn’t deployed docs yet.


πŸ”₯ 7. Can You Do This for Multiple Projects? YES

You are not limited to one project.

You can host unlimited GitHub Pages websites with unlimited subdomains:

debugbox.ibtisam-iq.com
nectar.ibtisam-iq.com
silverkube.ibtisam-iq.com
engineering.ibtisam-iq.com
aiops.ibtisam-iq.com

Cloudflare DNS entries:

CNAME debugbox     ibtisam-iq.github.io
CNAME nectar       ibtisam-iq.github.io
CNAME silverkube   ibtisam-iq.github.io
CNAME aiops        ibtisam-iq.github.io
CNAME playbook     ibtisam-iq.github.io

Each project:

  • Has its own repo
  • Has its own GitHub Pages
  • Has its own custom domain
  • Has its own docs
  • Has its own branding

This is how top OSS engineers build their ecosystem.


🧠 8. Why This Works (Simple Explanation)

GitHub Pages serves project websites based on the CNAME file inside each repo.

Example:

Repo A:

CNAME β†’ debugbox.ibtisam-iq.com

Repo B:

CNAME β†’ nectar.ibtisam-iq.com

Repo C:

CNAME β†’ silverkube.ibtisam-iq.com

Cloudflare DNS decides:

debugbox β†’ ibtisam-iq.github.io
nectar β†’ ibtisam-iq.github.io
silverkube β†’ ibtisam-iq.github.io

GitHub Pages decides:

Which repo? Check CNAME file.

Thus: unlimited sites are possible.


πŸ› οΈ 9. Common Troubleshooting

1. Seeing 404 on custom domain?

GitHub Pages hasn't deployed your site yet.

2. SSL not working?

Cloudflare still issuing certificate β†’ wait 2–15 minutes.

3. GitHub Pages says β€œDomain not verified”?

DNS record not propagated yet.

4. Site loads without CSS?

Cloudflare proxy accidentally ON β†’ turn OFF (gray cloud).


🧩 10. Summary

You now understand:

βœ” How GitHub Pages works

βœ” Why Cloudflare controls DNS

βœ” How custom domains work

βœ” How SSL works

βœ” How to integrate Cloudflare + GitHub

βœ” How to deploy Docs Pages

βœ” How to host unlimited project docs

βœ” How to do a professional OSS setup

Your DebugBox docs site is now correctly hosted at:

https://debugbox.ibtisam-iq.com

This is fully production-grade and follows CNCF-level standards.