A complete guide to deploying a portfolio site from a private GitHub repo using Cloudflare Pages, DNS, HTTPS, redirects, and DNSSEC — with zero cost and maximum security.
Why I Built this
I wanted a clean, secure, and professional online presence:
- Without exposing my GitHub code
- Without paying for hosting or domain-linked mail servers
- Without sacrificing speed, reliability, or security
- This setup delivers on all of that.
Goals
✅ Deploy from a private GitHub repo
✅ Use a custom domain with full HTTPS
✅ Enforce DNSSEC and redirect rules
✅ Host everything 100% free
Step-by-Step Setup
Create & Push Your Portfolio Repo
- Initialize a private GitHub repo named portfolio
- Add your static site files (index.html, images, etc.)
- Add a CNAME file with your custom domain (e.g., www.example.com)
Deploy via Cloudflare Pages
- Go to
pages.cloudflare.com
- Click Create Project → Select your private repo
- Choose "None" as the framework, set output directory as .
- Deploy
✅ You now have a live site at https://your-project.pages.dev
Transfer DNS to Cloudflare
- Add your domain to Cloudflare
- Let it scan for existing records (optional)
- Update your domain's nameservers in Namecheap to the ones Cloudflare gives you (e.g.,
dion.ns.cloudflare.com
)
Add DNS Records
In Cloudflare DNS:
- Add a CNAME:
Name: www
Value: your Pages URL (e.g., `your-project.pages.dev`)
Proxy status: DNS only (important)
- Add an A record:
Name: @
Value: 192.0.2.1 (dummy IP to enable redirect)
Proxy status: Proxied
Add a Custom Domain to Pages
- In Cloudflare Pages → Your Project → Custom Domains
- Add www.example.com
- Choose "My DNS provider"
- Verify CNAME setup
- Enable HTTPS (Cloudflare will issue a free cert)
Redirect example.com to www.example.com
- Go to Rules → Page Rules
- Add two rules:
http://example.com/* → Forward to https://www.example.com/$1
https://example.com/* → Forward to https://www.example.com/$1
Enable DNSSEC
- In Cloudflare → DNS → DNSSEC → Enable
- Copy the DS record Cloudflare gives you
- Go to Namecheap → Domain → Advanced DNS → DNSSEC → Add DS Record
- Paste the values from Cloudflare
✅ Now your domain is cryptographically signed
Why This Matters
In 2025, you shouldn’t have to:
- Pay for basic static hosting
- Expose your GitHub repo just to host a site
- Settle for a default pages.dev domain
- Compromise on security or speed
This setup checks all the boxes:
✅ Zero cost
✅ Zero code exposure
✅ 100% secure
✅ 100% under your control
Final Result
Accessible at: https://www.example.com
- Private GitHub powered
- HTTPS + DNSSEC secured
- Lightning-fast via Cloudflare
Want Help Doing the Same?
Drop a comment or connect on X/LinkedIn — happy to help others set this up.
If this guide helped you, please react, save, or share to support more privacy-first builders.
Top comments (0)