Cloudflare 简易接入指南
![Cloudflare 简易接入指南](https://cdn.sanity.io/images/ntncowsx/production/d5f2a0126e581b524f83ab79fd6bc66a03f808f2-1201x628.png?auto=format)
我们将一步步指导你如何快速⚡️接入 Cloudflare。如果你不了解 Cloudflare 可以先查看 Cloudflare 介绍。
添加网站到 Cloudflare
注册 Cloudflare 后进入主界面,点击“Add a site”。
![](https://cdn.sanity.io/images/ntncowsx/production/21a9b9ff45bf94c4aeed844c4b919548441f48f3-1280x814.png?w=1200&fit=max&auto=format)
输入你的域名,点击“Continue”。
![](https://cdn.sanity.io/images/ntncowsx/production/af1199193144b1581aac635ad3ef8d51ddae807d-1280x513.png?w=1200&fit=max&auto=format)
选 Free 的套餐,再点击“Continue”。
![](https://cdn.sanity.io/images/ntncowsx/production/3cb8e4f30fd419d5d09dc9f35f4a1c7ac08a1711-1280x499.png?w=1200&fit=max&auto=format)
一路继续到第三步。
![](https://cdn.sanity.io/images/ntncowsx/production/5d186fc1c60daad3006a1e5be7fa67ba90bd1434-1020x496.png?w=1200&fit=max&auto=format)
往下拉会看到两个 nameserver,然后将你域名 DNS 的 nameserver 改成这两个 nameserver 就可以。
![](https://cdn.sanity.io/images/ntncowsx/production/9b790234e401b1cd72138be79941d851925feea2-1044x808.png?w=1200&fit=max&auto=format)
修改 Nameservers
这里我用 Dynadot 演示,进入 DNS 设置界面。
![](https://cdn.sanity.io/images/ntncowsx/production/5d16d634def2339b10b4d1e828404826ce963470-1654x622.png?w=1200&fit=max&auto=format)
按图示输入 Name Servers,然后点击 “Save Name Server” 保存,这样就完成了 Nameservers 配置。
![](https://cdn.sanity.io/images/ntncowsx/production/39e730ea51dbf467e8454ea1021785a5c71c9f44-724x573.png?w=1200&fit=max&auto=format)
添加 DNS 解析
回到 Cloudflare DNS 管理面板,等待 Nameservers 验证完成后,添加两条 DNS 解析:
- A 记录,Name 为你的域名,Content 为你的服务 IP
- CNAME 记录,Name 为 www,Content 为你的域名
注意,Proxy status 都开启,不然享受不了 Cloudfare 的 CDN。
![](https://cdn.sanity.io/images/ntncowsx/production/59449197375cce1af10d5f8284e3667d69818761-1269x398.png?w=1200&fit=max&auto=format)
如果你不是自托管,而是使用 Vercel 部署,DNS 修改方法可以查看《Vercel 应用绑定 CloudFlare 域名指南》。
一般等十几分钟 DNS 解析生效后,你的网站就接入 CDN 成功了。
验证
打开 whois 查询你的域名,如果 Name Servers 变成 Cloudflare 说明接入成功了🥳。
![](https://cdn.sanity.io/images/ntncowsx/production/190eda43f1cc6c764596579bce42079b2e54d8ea-811x523.png?w=1200&fit=max&auto=format)