Vercel 部署
This content is not available in your language yet.
Vercel 提供全球边缘网络、自动 HTTPS 和极速部署,非常适合静态博客托管。
有两种方式将 Gridea Pro 博客部署到 Vercel:
方式一:通过 GitHub 仓库(推荐)
Section titled “方式一:通过 GitHub 仓库(推荐)”这种方式利用 Vercel 与 GitHub 的集成,每次 Gridea Pro 同步推送后自动触发部署。
- 先按照 GitHub Pages 部署的步骤创建 GitHub 仓库并配置 Gridea Pro
- 登录 Vercel,点击 Import Project
- 选择你的博客仓库
- Framework Preset 选择 Other
- Build Command 留空(Gridea Pro 已经生成了静态文件)
- Output Directory 设置为
.(根目录) - 点击 Deploy
方式二:Vercel CLI 手动部署
Section titled “方式二:Vercel CLI 手动部署”如果不想通过 GitHub,可以使用 Vercel CLI 直接上传:
# 安装 Vercel CLInpm i -g vercel
# 进入 Gridea Pro 的输出目录cd ~/Documents/Gridea/output
# 部署vercel --prod- 在 Vercel 项目的 Settings > Domains 中添加你的域名
- 按照提示在 DNS 中添加对应记录(CNAME 或 A 记录)
- Vercel 会自动签发 SSL 证书
- 在 Gridea Pro 中更新站点域名
Vercel 免费套餐包含:
| 特性 | 限制 |
|---|---|
| 带宽 | 100 GB / 月 |
| 构建次数 | 6000 次 / 月 |
| 自定义域名 | 50 个 |
| HTTPS | 自动、免费 |
| 全球 CDN | 包含 |
可以在仓库根目录创建 vercel.json 自定义路由和头信息:
{ "headers": [ { "source": "/styles/(.*)", "headers": [ { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" } ] } ], "rewrites": [ { "source": "/(.*)", "destination": "/404.html" } ]}