求助:Cloudflare配置Freenom .tk域名与GitHub Pages部署问题
Fixing the "There isn't a GitHub Pages site here" 404 Error with Freenom .tk + Cloudflare
Hey there! Let’s work through getting your .tk domain, Cloudflare, and GitHub Pages playing nice together—those 404 errors can be frustrating, but this setup is totally fixable with a few targeted checks.
Step 1: Verify Your GitHub Pages Foundation First
Before diving into Cloudflare, make sure your GitHub Pages setup is solid:
- Enable Pages & Pick the Right Branch: Go to your repo’s
Settings > Pages, confirm Pages is enabled, and you’ve selected the correct branch (usuallymainorgh-pages) and root directory (/rootunless you’re using/docs). - Add Your Custom Domain: In the same Pages settings, enter your
.tkdomain in the "Custom domain" field and hit save. This should auto-generate aCNAMEfile at the root of your repo—double-check that file exists and only contains your domain (no extra spaces or newlines). - Check GitHub’s Status: Look for the green "Your site is published at https://yourdomain.tk" message. If there’s an error here (like domain verification pending), that’s likely the root cause.
Step 2: Configure Cloudflare DNS Correctly
This is where most people trip up—let’s get your DNS records aligned:
- Confirm Nameservers Are Updated: First, ensure you’ve replaced Freenom’s default nameservers with Cloudflare’s assigned ones. You can find these in Cloudflare’s dashboard under
Domain > DNS > Nameservers. If you haven’t done this yet, go to your Freenom domain settings, swap the NS records, and wait 10-30 minutes for this to propagate. - Add the Right DNS Records: In Cloudflare’s DNS panel, add these records (set all to
DNS only—leave the orange cloud off for now to avoid proxy conflicts):- A Records: For the
@hostname (your root domain), add all four GitHub Pages IPv4 addresses:185.199.108.153185.199.109.153185.199.110.153185.199.111.153
- AAAA Records (Optional but Recommended): For
@, add GitHub’s IPv6 addresses:2606:50c0:8000::1532606:50c0:8001::1532606:50c0:8002::1532606:50c0:8003::153
- CNAME Record: For the
wwwhostname, point it to your GitHub Pages default URL (e.g.,yourusername.github.io).
- A Records: For the
- SSL/TLS Settings: Head to
SSL/TLS > Overviewand set the mode toFlexible(this avoids certificate issues while you get things working; you can upgrade toFulllater if you have a valid SSL cert).
Step 3: Wait for Propagation & Clear Caches
DNS changes don’t happen instantly, so give it some time:
- Check DNS Propagation: Use a terminal command like
nslookup yourdomain.tkto confirm your domain is resolving to GitHub’s IPs. If it’s still pointing to Freenom’s servers, wait a bit longer (sometimes up to an hour for full propagation). - Clear Browser Cache: Open an incognito window or clear your browser’s cache/cookies before testing—old cached DNS data can still show the 404 even after settings are correct.
- Recheck GitHub Pages: Go back to your repo’s Pages settings and hit "Save" again for good measure—sometimes retriggering the domain sync helps.
Common Pitfalls to Avoid
- Don’t Enable Cloudflare Proxy Too Early: The orange cloud (proxy mode) can interfere with GitHub’s domain verification. Keep it off until your site loads correctly, then turn it on if you want Cloudflare’s performance/security features.
- Freenom DNS Delays: Freenom’s nameservers can be slow to update—if you just swapped them, give it a few hours before troubleshooting further.
- Missing CNAME File: If the
CNAMEfile in your repo gets deleted (e.g., from a git push), GitHub will stop recognizing your custom domain. Re-add it manually or re-save the domain in Pages settings to regenerate it.
Once all these steps are done, your .tk domain should load your GitHub Pages site without the 404. If you’re still stuck, double-check each setting—small typos (like a missing dot in the CNAME target) are often the culprit!
内容的提问来源于stack exchange,提问作者Nuke Mdfkz
相关产品推荐
相关产品推荐

