type
Post
status
Published
date
Nov 19, 2022
slug
2022.11.19 折腾免费域名-小白秘籍
summary
2022.11.19 折腾免费域名-小白秘籍
tags
工具
建站
category
胡言乱语系列
icon
password
0. 搭一个博客,部署在 Vercel 上
你的网站如果部署在 vercel 上,vercel 有为你的站点提供一个
*.vercel.app
的域名,但 vercel 的这个官方域名在大陆被墙,所以需要绑定自己的域名。而自己的域名,你也是可以用免费的,不用花一分钱就能拥有,但是不好的地方是,由于这些免费域名被各种黑灰产用烂了,所以一般的搜索引擎都不收录的,而且有一些免费域名在大陆也是被墙的,需要仔细挑选一下。
下面就为小白同学们详细一步步介绍怎么折腾这个免费域名。逻辑很简单,你在 Freenom 申请一个免费域名,然后托管到 CloudFlare 上,让其为你做 DNS 解析到 Vercel 上,然后 Vercel 后台配置指向你的站点,收工。
1. Freenom免费域名与付费域名的区别
Freenom 是全球最大的免费域名注册网站,也是世界上第一个且唯一的专业免费域名提供商。官网地址:https://www.freenom.com/,Freenom 同时提供免费域名和付费域名,他们的区别如下:
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F21f387b9-0f19-44e4-952b-78671647dd1e%2FUntitled.png%3Ftable%3Dblock%26id%3D5bbf6723-104a-4024-89c5-12a3ae343ce5%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DKiHZAzsc2YHqr_LGKYWE4LVbmUgjwgfPtUjkwdnLUVc?table=block&id=5bbf6723-104a-4024-89c5-12a3ae343ce5&cache=v2)
2. 注册Freenom免费域名
Freenom 提供的免费顶级域名后缀有 .tk .ml .ga .cf .gq,注册后,在申请之前需要先检测域名是否可用,如果你是在中国大陆,如果你直接输入域名点击“检查可用性”,会经过大陆地区的 IP 检测,然后有可能显示不可用,这时候,改为输入完整的域名即可。比如直接输入“xxxxxxx.tk”,就可以跳过大陆的 IP 检测显示可用性。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F48a9bfc0-c3c4-4124-9dd6-13ab609b4c07%2FUntitled.png%3Ftable%3Dblock%26id%3D89c4dca3-d8d8-4db1-bb06-4a1e4456587a%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DbS8xhbzazmtajPfy_xH-NPKNYmXc0LxC4x2tKifHWq4?table=block&id=89c4dca3-d8d8-4db1-bb06-4a1e4456587a&cache=v2)
点击“完成”,然后在跳转的落地页,选 12 个月免费 (可以无限续期)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F2d4309d7-7f50-41bd-b30b-4d73f881c0b7%2FUntitled.png%3Ftable%3Dblock%26id%3D66c91378-2a5d-4c3a-ac28-d4199b2e703a%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DM5AnFgR0Khj2_7VlWalENycLgmmsvG4FUDPFKk1R4d4?table=block&id=66c91378-2a5d-4c3a-ac28-d4199b2e703a&cache=v2)
点击“continue”后来到下一个页面,这里需要你注册一个账户 (也可以提前注册登录来操作上面的这些步骤),注册不提。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F33b124a9-b0b2-4307-8b91-614410e69793%2FUntitled.png%3Ftable%3Dblock%26id%3D54dcca67-31b9-4006-8b32-a7dca10f48fd%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DpLUnzblVc3HGqhufhnB8-0fquIWUQsDR8xnzJqJZC0o?table=block&id=54dcca67-31b9-4006-8b32-a7dca10f48fd&cache=v2)
登陆后其实看到的是下面这个订单页,点击“complete order”即可完成购买,可看到“Order Confirmation”页面,下方的按钮如果点了就会跳到这个免费域名的 NS 页面,显示NS服务器地址。虽然它提供了 DNS 解析服务,但是我们还是可以使用第三方的 DNS 服务,比如下面我们就用 CloudFlare 来做 DNS 解析,在配置好 CloudFlare 后,我们还会回到 freenom 来修改 NS 地址。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Fbef9ed35-078b-4266-af5c-75b18fb51378%2FUntitled.png%3Ftable%3Dblock%26id%3Dcb262015-00a8-4f9d-b305-e7527b3bf171%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DhkfC3Y_wxAV4Ckc5sZBWTX3gKT8YchjhHVWGAoc7SGo?table=block&id=cb262015-00a8-4f9d-b305-e7527b3bf171&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F3d6223b3-e008-4556-b91b-46cd27139e9c%2FUntitled.png%3Ftable%3Dblock%26id%3Dc981f7c9-58f8-4d90-a6a1-5a2b3fb81f1c%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DqD4qZwKNz35s4QlhIVmu-6V1y4H2JoF8NFMB9pXpshk?table=block&id=c981f7c9-58f8-4d90-a6a1-5a2b3fb81f1c&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Fb1f6f43a-0b6d-4472-977e-1555abe163e5%2FUntitled.png%3Ftable%3Dblock%26id%3Db914818d-7019-43bb-882f-8f2a6f69f21e%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3D3pLlZLpRavPEVwU3r8veorFoA2DxsWsOESvP8Vn0z24?table=block&id=b914818d-7019-43bb-882f-8f2a6f69f21e&cache=v2)
3. 在CloudFlare上托管域名
首先申请一个CloudFlare账户,然后登陆后在首页找到这个,点击后填入你申请到的域名,点“add site”
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F24064120-5425-4e2e-a937-a6f9a5cb2351%2FUntitled.png%3Ftable%3Dblock%26id%3Daa27679f-6db9-484b-b49f-727ddb0a1457%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3D0RHpvpg2HhvBhAA6oaDDUqIYUNkJWfMbrUm3dcKqrxY?table=block&id=aa27679f-6db9-484b-b49f-727ddb0a1457&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F53384db9-9fd4-4771-a15f-2c86b175e255%2FUntitled.png%3Ftable%3Dblock%26id%3Dbc608f9c-27e8-490f-a782-e44cd9c10cd4%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DUrs0_DQMf7aX7b7oJhIT4jxLHT2IdW2WKnWB8vJcmhg?table=block&id=bc608f9c-27e8-490f-a782-e44cd9c10cd4&cache=v2)
即然是白嫖,当然是要选择 free 啦
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F1e46f1eb-160a-43f3-b452-7e47ab8c2082%2FUntitled.png%3Ftable%3Dblock%26id%3Dffe5eab6-6f43-4eb4-917a-aa1aea9cb8fc%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DsXlF9P3L2_jdrnlg9naRwEb6O57UHx9YaPzihilJ_rs?table=block&id=ffe5eab6-6f43-4eb4-917a-aa1aea9cb8fc&cache=v2)
点击 continue 后你会看到下面的界面,先不管,回头再来配置,continue
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Fa6a77c7f-d16e-4ae3-9f33-86b01f89cecf%2FUntitled.png%3Ftable%3Dblock%26id%3Dff43485a-4cea-4ede-bc78-eeaf9b591061%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DIOnkxsj-LmKdk-2MjQie7nEb8fJFfV9DXWYK5vk98W8?table=block&id=ff43485a-4cea-4ede-bc78-eeaf9b591061&cache=v2)
continue 后会继续看到这样的界面,提示你 change your nameservers,然后需要用红框里的两个 NS 去覆盖之前 freenom 里的默认 NS,完成后记得点击下方“Done, Check nameservers”
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F7ccb0ec0-a708-446e-9c1d-84d3734859f2%2FUntitled.png%3Ftable%3Dblock%26id%3Dcff8017b-dab1-4264-af04-752fcd4773ea%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DXFJ4SI_t_V9ek68P82HULytbJQV-55Euf0iaB11k8c4?table=block&id=cff8017b-dab1-4264-af04-752fcd4773ea&cache=v2)
回到 freenom,在顶部菜单栏依次点击“Services”→”My Domains”,进入 domain 管理页面。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F71eea278-b51c-4b42-9e94-705df8066c75%2FUntitled.png%3Ftable%3Dblock%26id%3D484caa52-7489-477c-bcf3-05c355e4c896%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DYAfrAKJ_vJ8tmKIV968r_BVVnPxYrQQt7Is-II0SXjM?table=block&id=484caa52-7489-477c-bcf3-05c355e4c896&cache=v2)
点击 “Manage Domain”,在跳转后的页面再点击“Manage Tools”→”Nameservers”
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Ffcb72bb5-4535-436d-a92f-d94a9e3d6d80%2FUntitled.png%3Ftable%3Dblock%26id%3D30f31c79-41fd-4d49-b81c-61cea09c5e78%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DF-bBJIGtI7MfTjN0nnYLvhLJm_I8VHJoDWh7rmNTobo?table=block&id=30f31c79-41fd-4d49-b81c-61cea09c5e78&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F276380eb-46d2-4300-a26f-86678d3ab3cf%2FUntitled.png%3Ftable%3Dblock%26id%3D69a206a0-8227-4f20-ad21-c6a345003dbf%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3D-7AGQFgtTOdyKSu8Mz7ZLsQ1SYH0A-fY8XXkoI2OgwY?table=block&id=69a206a0-8227-4f20-ad21-c6a345003dbf&cache=v2)
选择“Use custom nameservers”,填入 cloudflare 分配的两个 NS。记得回去 cloudflare 上点击下方“Done, Check nameservers”,这样等一会,你的 freenom 免费域名就被 Cloudflare 成功托管了,一般一分钟后可以 ping 通这个域名地址。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F1c2366e3-fd5c-4515-b5fc-42cb248d1f41%2FUntitled.png%3Ftable%3Dblock%26id%3D31dab7ec-b3e0-4882-a38d-45d04d0f0e71%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DCF_dW8Nqocc3RVTY-CShmkU0rvcUwnwHcgACj7obV8E?table=block&id=31dab7ec-b3e0-4882-a38d-45d04d0f0e71&cache=v2)
4. CloudFlare 上的 DNS 配置
回到 cloudflare,左边菜单栏找到“DNS”,点击“add record”开始配置域名解析。
- 如果你的域名没有绑定过任何一条A记录,则添加一条域名 A 记录指向 Vercel 服务器地址 :
76.223.126.88
或76.76.21.98
(这两个是为大陆地区定制的),注意这里 Proxy Status 最好是设置成 DNS only,防止重定向过多。
- 如果需要可以再配置一个别名 CNAME,Vercel 为大陆定制 CNAME:
cname-china.vercel-dns.com
- 另外就是需要在 ssl/tls 配配置开启 https 加密,这样可以通过 https 协议访问。
- 操作完后能看到 zhangqiyuan.tk 是 active 状态,说明域名已经可以通过 cloudflare 进行解析了。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F2b3f23a0-d781-4c81-b393-5f731053abb3%2FUntitled.png%3Ftable%3Dblock%26id%3Df8e9d6f1-43a5-4efe-82ec-d77082e31707%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3D3ZcvBUUlI9Iy6AfE-KwYDx7spg9CbiPdmCaPUUp-iTE?table=block&id=f8e9d6f1-43a5-4efe-82ec-d77082e31707&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F3f43aabf-e653-4fe6-8ee1-66e7bd9f9075%2FUntitled.png%3Ftable%3Dblock%26id%3D0472f3c5-679e-4e93-9b37-594c8da67496%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DvZlj1p1F9uR9czUMaXwtnk3haE0DJ9IXuujTzOErUQ0?table=block&id=0472f3c5-679e-4e93-9b37-594c8da67496&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Fc6ef9ffc-3e01-4683-8259-47f5612aa936%2FUntitled.png%3Ftable%3Dblock%26id%3D4610169d-ee3a-4988-9227-6b6776430688%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3De5R51e4qC2Ekm4igyVnXn0eeSXbX_M_0tNQ6X6QpzZ0?table=block&id=4610169d-ee3a-4988-9227-6b6776430688&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Fe05cb43e-ca0a-40e3-89b3-c175f11f3d46%2FUntitled.png%3Ftable%3Dblock%26id%3D25470254-294e-4a7b-8c3f-f67f8756e446%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DGbI6xkQg2glCt2CwkJ8D1lLKq5VlYLP5Qyh-tIR4WRI?table=block&id=25470254-294e-4a7b-8c3f-f67f8756e446&cache=v2)
5. Vercel 的配置
你的网站如果部署在 vercel 上,vercel 有为你的站点提供一个
*.vercel.app
的域名,但 vercel 的这个官方域名在大陆被墙,所以需要绑定自己的域名。通过上面的 1-4 过程你已经设置好了一个自己的域名,并解析到了 vercel,但是还差最后一步在 vercel 的配置,让其最终指向你的网站。
来到 vercel 网站,依次点击“Domains”→”Add”→选择你想指向的项目→”continue”,然后填入你自己的域名,最终的结果如下方最后一张图所示,这个时候你就可以通过 “zhangqiyuan.tk” 访问你部署在 vercel 上的站点了。
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F7020e125-6820-4bfd-a71c-a77b7b04ea1c%2FUntitled.png%3Ftable%3Dblock%26id%3D3da0c7f2-0555-4a43-b716-53229d6300ca%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3DVFKjD70GysiPXGGCgS6L3xTlyscQIcph_U_m3q7aQ7c?table=block&id=3da0c7f2-0555-4a43-b716-53229d6300ca&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2Ff29b9bec-095a-4898-a736-d37fada9b331%2FUntitled.png%3Ftable%3Dblock%26id%3D0ad3e1f6-c4e2-4dac-bf17-d1ee19948693%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3Dn-UpkmdON7Y7sLpxf9xyIRuUx0g4y9mEQMmJqbigH14?table=block&id=0ad3e1f6-c4e2-4dac-bf17-d1ee19948693&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Ffile.notion.so%2Ff%2Ff%2Fafdd680a-876e-4511-91a1-e1f4fcf8337b%2F63a8f9b8-bf82-43a6-9cdd-36ce64f1a40f%2FUntitled.png%3Ftable%3Dblock%26id%3D60e725c2-cdd5-4d86-b1f5-3be557701c96%26spaceId%3Dafdd680a-876e-4511-91a1-e1f4fcf8337b%26expirationTimestamp%3D1725789600000%26signature%3Df2hb8gj3ncMA5hyq5-cGWvBF5CyFW6_Oybl7s3dMK1k?table=block&id=60e725c2-cdd5-4d86-b1f5-3be557701c96&cache=v2)