没有不值得去解决的问题,也没有不值得去学习的技术!

A Complete Migration Guide From Alibaba Cloud DNS to Cloudflare Global Accelerator

图16:浏览器访问正常,网站全球访问成功

作者:

在

📌 1. Background: Why Implement Cloudflare CDN

In this practice, my blog was deployed on an Alibaba Cloud ECS + OneinStack environment, with the initial architecture as follows:

  • Single-node WordPress deployment
  • Alibaba Cloud DNS resolution
  • Primarily targeting domestic access (about 80% of traffic)
  • Gradually increasing overseas access

As the traffic profile shifted, I began introducing Cloudflare:

🌍 Goal: Improve overseas access speed + optimize TTFB + enhance overall stability


🧭 2. Target Migration Architecture

The final desired outcome is:

Bash
用户  ↓Cloudflare CDN(全球节点)  ↓阿里云 ECS(WordPress)

🧪 3. Complete DNS Migration Process (Core Steps)


[Step 1] Alibaba Cloud DNS Resolution Confirmation

Figure 1: All current domain resolutions are still managed in Alibaba Cloud DNS
Figure 1: All current domain resolutions are still managed in Alibaba Cloud DNS

[Step 2] Register on Cloudflare and Add the Site

Figure 2: Add shuijingwanwq.com to Cloudflare
Figure 2: Add shuijingwanwq.com to Cloudflare

[Step 3] DNS Record Scanning and Import

Figure 3: Cloudflare automatically identifies existing A / CNAME / MX records, but because the results were incomplete, I ultimately chose to export them from Alibaba Cloud and then import them
Figure 3: Cloudflare automatically identifies existing A / CNAME / MX records, but because the results were incomplete, I ultimately chose to export them from Alibaba Cloud and then import them

[Step 4] DNS Record Verification (Critical)

Figure 4: Check if the main domain, www, and email records are complete
Figure 4: Check if the main domain, www, and email records are complete

[Step 5] Cloudflare Provides NS

Figure 5: System generates adaline / alfred nameservers
Figure 5: System generates adaline / alfred nameservers

[Step 6] Modify Alibaba Cloud NS

Figure 6: Replace vip1/vip2 alidns with Cloudflare NS
Figure 6: Replace vip1/vip2 alidns with Cloudflare NS

[Step 7] NS Switch Submission Complete


🧠 4. DNS Propagation Verification Process


[Step 8] Local DNS Check

Figure 8: dig NS command result (local), still showing alidns, indicating it has not taken effect yet
Figure 8: dig NS command result (local), still showing alidns, indicating it has not taken effect yet

[Step 9] Public DNS Verification (1.1.1.1)

Figure 9: Cloudflare DNS query result, confirming DNS propagation status
Figure 9: Cloudflare DNS query result, confirming DNS propagation status

[Step 10] Google DNS Verification

Figure 10: 8.8.8.8 query result, verifying global propagation status
Figure 10: 8.8.8.8 query result, verifying global propagation status

⚡ 5. Cloudflare Official Activation Verification


[Step 11] Final NS Activation Confirmation

Figure 11: Authoritative DNS has been completely changed
Figure 11: Authoritative DNS has been completely changed

[Step 12] HTTP Response Header Check

Figure 12: curl -I return result, server: cloudflare has appeared
Figure 12: curl -I return result, server: cloudflare has appeared

[Step 13] 301 Redirect Check

Figure 13: Main domain redirects to www, indicating a successful canonical URL structure
Figure 13: Main domain redirects to www, indicating a successful canonical URL structure

[Step 14] CF-Ray Node Verification

Figure 14: Cloudflare edge node response, request has entered the SJC node
Figure 14: Cloudflare edge node response, request has entered the SJC node

[Step 15] Cache Status Analysis

Figure 15: cf-cache-status = DYNAMIC, WordPress dynamic origin pull is normal
Figure 15: cf-cache-status = DYNAMIC, WordPress dynamic origin pull is normal

[Step 16] Final Access Test

Figure 16: Browser access is normal, global website access is successful
Figure 16: Browser access is normal, global website access is successful

🌍 6. Final Architecture State

Plaintext
User  ↓Cloudflare (DNS + CDN + TLS + Edge)  ↓Alibaba Cloud ECS (WordPress)

🚀 7. Key Outcomes

This migration accomplished:

✔ DNS fully migrated to Cloudflare
✔ NS globally active
✔ CDN takeover successful
✔ HTTPS + HTTP/2 active
✔ Global node acceleration (SJC, etc.)
✔ WordPress running normally


⚡ 8. Performance Changes (Initial Observations)

  • Initial requests now enter the Cloudflare edge node
  • 301 redirect optimization completed
  • TTFB has shown an improving trend
  • Overseas access path optimization completed

🧠 9. Lessons Learned

The most critical points of this migration:

✔ 1. DNS Migration ≠ CDN Activation

You must wait for global NS propagation

✔ 2. Cloudflare Requires cf-ray Verification

To determine if it has truly taken over

✔ 3. DNSSEC / NS Status Must Be Confirmed

To avoid “false activation”

✔ 4. WordPress Dynamic Pages Are Not Cached by Default

Cache Rules need to be optimized later


📌 10. Future Optimization Directions

Next, I will continue to optimize:

  • Cloudflare Cache Rules (HTML caching)
  • /en/ international SEO acceleration
  • Static resource caching strategy
  • TTFB optimization
  • AdSense loading optimization
CDN 忽略 Query String 踩坑:WordPress ?p= 被吞后,百度落地页竟然变成了首页<< 补上日期归档分页测试:EdgeOne 与 Cloudflare Query String 归一化再次验证<< 从 EdgeOne 524 到 Query String 归一化:WordPress 文章与公开列表页 CDN 缓存优化实战<< EdgeOne 请求数突然暴涨:从 177 万次异常请求定位到百万级 PHP 文件扫描<< WordPress 发布新文章后首页仍是旧内容?EdgeOne 与 Cloudflare 将首页和 Sitemap 缓存缩短到 2 小时实测<< Cloudflare 526 排查实录:acme.sh 的 RSA / ECC 双证书自动续期,如何把英文站 SSL 覆盖坏了<< 用 EdgeOne 与 Cloudflare 统一解决 WordPress 随机 Query String 缓存穿透:只优化 canonical 文章 URL<< WordPress 双 CDN 缓存实测:HTML TTL 统一为 12 小时后,EdgeOne 与 Cloudflare Hit 是否提升?<< 将 media、en、admin 拆出 EdgeOne 后,当前网站性能实测:BOCE、成都移动与 WebPageTest 对比<< 将 media、en、admin 拆出 EdgeOne 后,我重新估算了网站每月的实际 CDN 成本<< WordPress 多域名架构暂停复盘:en、admin、W3TC 与多 CDN 的可维护性重新评估<< 将 WordPress 后台迁移到独立 admin 子域名:绕过 EdgeOne,解决核心升级 524 超时<< WordPress 英文站从 /en/ 迁移到 en 子域名:兼容数千条 Nginx 旧规则并避免二次 301<< 将 Polylang 英文子域名接入 Cloudflare:HTML 缓存、登录绕过与后台入口收敛<< WordPress Polylang 英文站从 /en/ 迁移到 en 子域名:W3TC 与 Redis 缓存问题排查<< OneinStack 现有 Nginx 虚拟主机追加域名并重签 SSL 证书的一次实操记录<< WordPress 核心升级反复 524 与“另一更新正在进行”的排查记录<< EdgeOne 流量成本控制决策:是否将英文站从 /en/ 迁移到 en.shuijingwanwq.com<< WordPress Media CDN 迁移后的 Cloudflare Cache Rules 调整记录<< WordPress 图片迁移到 media 子域名后,EdgeOne 仍然出现大量 301 的排查与处理记录<< EdgeOne 流量成本排查:将 WordPress uploads 静态资源迁移到 Cloudflare media 子域名<< Cloudflare Free 迁移到 EdgeOne 后到底快了多少?WordPress CDN 三阶段 boce 与 WebPageTest 实测对比<< 从 Cloudflare Free 迁移到腾讯云 EdgeOne:一次 WordPress 主站国内外加速实战<< Cloudflare 免费版适合中国大陆 WordPress 主站吗?从缓存 HIT 到灰云直连阿里云 ECS 的实测复盘<< CDN 上线前后性能对比实测:WordPress 缓存误判修正与真实加速效果验证<< WordPress + Cloudflare 推荐配置与 Cache Rules 实战优化(SSL / API / 缓存闭环完整记录)<< Cloudflare SSL/TLS 与 Cache Rules 配置实战<< 从阿里云 DNS 到 Cloudflare 全球加速的完整迁移实战记录

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系