Vercel 国内加速实战:$6/月香港服务器,提速 3-8 倍
Vercel 部署 Next.js 是真的爽,但国内用户打开你的网站要 5-10 秒,这就不爽了。
商业方案动辄 $50-200/月,还要备案。我用 $6/月的香港服务器搞定了,不备案,Vercel 所有功能照用。
痛点
Vercel 的 CDN 节点在美国、日本、新加坡——就是没有中国大陆。
国内用户访问你的 Vercel 站点:
- 首屏加载:3-5 秒(海外 0.5 秒)
- 完整页面:5-10 秒
- 跳出率:飙升
备案?需要国内公司主体,审批周期 1-3 个月。如果你是海外开发者或者做国际产品,这条路走不通。
方案架构
国内用户 → 香港 VPS (Nginx 反代) → yourapp-origin.example.com (CNAME → Vercel)
海外用户 → 76.76.21.21 (Vercel 官方 A 记录 IP)
核心思路:
- 香港离大陆近,延迟 under 50ms,且不需要备案
- Nginx 反代 Vercel,对用户透明
- Route 53 地理路由,自动分流
为什么要 -origin 子域名?Vercel 要求自定义域名用 CNAME,但 Route 53 地理路由需要 A 记录。同一个子域名不能同时有 A 和 CNAME。解决方案:新建 yourapp-origin.example.com 指向 Vercel,Nginx 反代这个地址。
准备工作
- 一台香港 VPS(腾讯云国际版 Lighthouse $6/月,或 Vultr/DO)
- 域名在 Route 53 或支持地理路由的 DNS
- Vercel 项目已部署
Step 1:购买香港 VPS
腾讯云国际版 Lighthouse:https://intl.cloud.tencent.com/
配置:
- 地区:香港
- 系统:Ubuntu 24.04
- 规格:1C1G 够用
- 月费:$6
其他选择:Vultr 香港 $6/月、阿里云国际版香港 $4-10/月。
拿到 IP 后,SSH 登录(用 ubuntu 用户,不是 root):
ssh ubuntu@43.xxx.xx.xxx
Step 2:配置 Origin 子域名
在你的 DNS 里:
- 新建
yourapp-origin.example.com,类型 CNAME,值cname.vercel-dns.com - 去 Vercel Dashboard → Domains,添加
yourapp-origin.example.com - 等 Vercel 验证通过(一般秒过)
这样你就有了一个可以被 Nginx 反代的 Vercel 入口。
Step 3:安装 Nginx + Certbot
sudo apt update && sudo apt upgrade -y
sudo apt install nginx certbot python3-certbot-nginx -y
sudo systemctl enable nginx
开放 80 和 443 端口:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Step 4:Nginx 反代配置
创建站点配置:
sudo nano /etc/nginx/sites-available/yourapp.example.com
内容:
server {
listen 80;
server_name yourapp.example.com;
location / {
proxy_pass https://yourapp-origin.example.com;
proxy_ssl_server_name on;
proxy_set_header Host yourapp-origin.example.com;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
# WebSocket 支持
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}
启用站点:
sudo ln -s /etc/nginx/sites-available/yourapp.example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 5:申请 SSL 证书
sudo certbot --nginx -d yourapp.example.com
跟着提示走,Certbot 会自动配置 HTTPS 和 HTTP 跳转。
验证自动续期:
sudo certbot renew --dry-run
Step 6:Route 53 地理路由
关键步骤。在 Route 53 里给 yourapp.example.com 创建两条 A 记录:
记录 1(亚洲流量):
- 类型:A
- 值:
43.xxx.xx.xxx(香港 VPS IP) - 路由策略:Geolocation
- 位置:Asia
- 记录 ID:
yourapp-asia
记录 2(默认/全球):
- 类型:A
- 值:
76.76.21.21(Vercel 官方 IP) - 路由策略:Geolocation
- 位置:Default
- 记录 ID:
yourapp-default
76.76.21.21是 Vercel 文档里给的 A 记录 IP。
这样配完:
- 亚洲 IP 访问 → 解析到香港 VPS
- 其他地区 → 直接到 Vercel
验证效果
从国内测试(找个朋友帮忙,或者用 17ce.com):
| 地区 | 之前 | 之后 |
|---|---|---|
| 上海 | 4-8s | 0.8-1.5s |
| 北京 | 5-10s | 1-2s |
| 香港 | 2-3s | 0.3-0.5s |
| 美国 | 0.5s | 0.5s(不变) |
成本
| 项目 | 月费 |
|---|---|
| 腾讯云香港 Lighthouse | $6 |
| Route 53 托管区 | $0.50 |
| Route 53 查询 | ~$0.40/百万次 |
| Let's Encrypt | 免费 |
| 合计 | ~$7/月 |
对比商业方案:
- Cloudflare 中国网络:$200+/月
- 国内 CDN + 备案:周期长 + $50+/月
- Vercel 企业定制:报价说话
注意事项
-
这不是 CDN:静态资源还是要过香港服务器。如果静态资源很重,可以在 Nginx 加
proxy_cache,或者用国内 CDN(需备案)。 -
单点故障:香港 VPS 挂了,国内用户就挂了。生产环境建议加监控(UptimeRobot 免费)和备份 VPS。
-
真实 IP:国内流量的用户 IP 在 Vercel 那边会显示成香港 VPS 的 IP。需要真实 IP 的话,在应用里解析
X-Forwarded-For头。 -
Vercel IP 可能变:
76.76.21.21是官方文档的 IP,但建议定期检查 Vercel 文档确认。
适用场景
这个方案适合:
- 出海产品有国内用户
- 营销站/官网需要国内能打开
- 1-2 秒加载时间可以接受
如果需要 under 500ms 的极致体验,最终还是要走备案 + 国内 CDN + 多区域部署的路子。
但对于大多数场景,$6/月的香港反代能解决 80% 的问题。
总结
全程 30 分钟,$6/月,国内访问速度提升 3-8 倍。
核心就三件事:
- 香港 VPS + Nginx 反代
- 新建
-origin子域名解决 CNAME 冲突 - Route 53 地理路由分流
如果你的国内用户在抱怨速度慢,先试这个方案。性价比极高,比直接上商业方案划算多了。
Want to work together?
I'm always happy to connect — whether it's a project, a question, or just to say hi.
Get in Touch →