零元域名上线记:钱包说谢谢 | Zero-Dollar Domain, Wallet Says Thanks

你以为拥有自己的网址要花钱?其实一分钱不花也行:一个免费域名、一个免费托管、一个备用小网址,三件套一晚上搞定。唯一要小心的是续期,记得在日历上写一笔,别让域名悄悄溜走。Mac 笔记本就能做,不用额外装什么大家伙,做完朋友问你“这网站谁做的”,你可以淡定地说:我。
Think a web address costs money? Not tonight. One free domain, one free host and one backup address, all set up in an evening on your Mac. The only thing to watch is renewal, so put a note in your calendar and the domain will not wander off. When a friend asks who built the site, you can say “me” with a straight face.
实操案例
用 0 元把一个 Vite 小网站挂到免费域名上,由 Cloudflare 解析,再用 lovie.me 做备用入口。
Put a tiny Vite site on a free domain via Cloudflare, with a lovie.me backup address, all for zero dollars.
1. 准备环境
在终端运行 `brew install node`,再输入 `node -v` 确认版本。
Run `brew install node` in Terminal, then `node -v` to check.
2. 注册 Cloudflare 账号
打开 https://dash.cloudflare.com/ 用邮箱注册,选 Free 套餐。
Sign up with your email at the Cloudflare dashboard and pick the Free plan.
3. 领取 DNSHE 免费域名
打开 https://www.dnshe.com/ 注册,选一个后缀(如 .us.ci)并输入你想要的名字。
Register on DNSHE, pick a suffix such as .us.ci and type the name you want.
4. 写一个小网站
运行 `npm create vite@latest hello-domain -- --template vanilla`,再 `cd hello-domain && npm install && npm run build`。
Run `npm create vite@latest hello-domain -- --template vanilla`, then `cd hello-domain && npm install && npm run build`.
5. 部署到 Cloudflare Pages
运行 `npx wrangler login` 登录,再运行 `npx wrangler pages deploy dist --project-name hello-domain`。
Run `npx wrangler login`, then `npx wrangler pages deploy dist --project-name hello-domain`.
6. 先看免费网址
终端会给出一个 `hello-domain.pages.dev` 地址,打开确认页面能显示。
The terminal prints a `hello-domain.pages.dev` address; open it and confirm the page loads.
7. 把 DNSHE 域名接入 Cloudflare
在 Cloudflare 点 Onboard a domain,输入你的 DNSHE 根域名,选 Free,记下它给的两个 NS。注意:这一步的前提是你使用的是 DNSHE 的根域名。如果你只想用子域名(如 `app.us.ci`),可以跳过这一步,直接看第 9 步的 CNAME 方案。
In Cloudflare click Onboard a domain, enter your DNSHE root domain, choose Free and note the two nameservers. Note: this step assumes you are using the DNSHE root domain. If you only need a subdomain (e.g., `app.us.ci`), you can skip this and go straight to the CNAME approach in step 9.
8. 到 DNSHE 改 NS
把 DNSHE 里的 NS 换成 Cloudflare 的两个,保存后等待状态变为 Active,通常几分钟到几小时。
Replace the NS at DNSHE with Cloudflare's two, save, and wait until the status is Active, usually minutes to hours.
9. 在 Pages 里绑定自定义域名
在 Pages 项目里打开 Custom domains,添加你的域名。Cloudflare 会自动配好解析和证书。
如果域名不在 Cloudflare 托管(例如你选的是 DNSHE 的子域名、或根本不想迁 NS),你需要在 DNSHE 面板手动添加一条 CNAME 记录:类型 CNAME,名称填你的子域名,内容填 `hello-domain.pages.dev`。
If your domain is not hosted on Cloudflare (for example, a DNSHE subdomain, or you simply don't want to move nameservers), add a CNAME record at DNSHE: Type CNAME, Name = your subdomain, Content = `hello-domain.pages.dev`.
10. 验证结果
运行 `dig +short NS 你的域名` 看到 Cloudflare 的 NS,再运行 `curl -I https://你的域名`,看到 200。
Run `dig +short NS yourdomain` to see Cloudflare's NS, then `curl -I https://yourdomain` and look for a 200.
11. 领取 Lovie.me 备用地址
在 https://www.lovie.me/ 注册,或在终端运行 `npx lovieme subdomains claim myapp`。
Sign up on Lovie.me or run `npx lovieme subdomains claim myapp` in the terminal.
12. 给备用地址加 CNAME 解析
在 Lovie 面板为 myapp 添加一条 CNAME,指向 `hello-domain.pages.dev`。这一步不需要在 Lovie 那边改 NS,也不需要把 lovie.me 迁到 Cloudflare。
In the Lovie console add a CNAME for myapp pointing to `hello-domain.pages.dev`. No nameserver change is needed on Lovie's side, and you do not need to move lovie.me to Cloudflare.
13. 在 Pages 里添加备用地址
在 Pages 的 Custom domains 里添加 `myapp.lovie.me`。因为 `lovie.me` 的 DNS 在 Lovie 手里而不是 Cloudflare,Cloudflare 可能会要求你添加一条 TXT 记录来验证域名所有权。按页面提示把 TXT 记录加到 Lovie 面板即可,CNAME 和 TXT 可以同时存在,不冲突。
In Pages Custom domains add `myapp.lovie.me`. Because `lovie.me` DNS is managed by Lovie (not Cloudflare), Cloudflare may ask you to add a TXT record for domain ownership verification. Add that TXT record in the Lovie panel — the CNAME and TXT records can coexist without conflict.
14. 设置续期提醒
DNSHE 域名默认 1 年,到期前 180 天内可免费续期,请在日历上设两个提醒。
The DNSHE domain lasts 1 year by default and can be renewed free within 180 days before expiry, so set two calendar reminders.
15. 看看反常识的数字
这套组合花费 0 美元,而 Pages 免费版一个项目最多能绑 100 个域名,也不会因为你绑得少而多收钱。
The setup costs 0 dollars, and one free Pages project can hold up to 100 custom domains.
相关链接/Related Links: https://www.lovie.me/pricing https://www.dnshe.com/ https://dash.cloudflare.com/ https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/ https://developers.cloudflare.com/fundamentals/manage-domains/add-site/ https://developers.cloudflare.com/pages/platform/limits/ https://developers.cloudflare.com/pages/configuration/custom-domains/ https://github.com/stackryze/FreeDomains https://domain-docs.stackryze.com/faq/ https://tempail.com/ https://ping.pe/ https://www.stronki.dev/en https://www.cloudflare.com/
评论
发表评论