Vercel Alternative 2026: Self-Host Next.js on Your Own VPS (Step by Step)
说明与用途
在 VPS 上自行托管 Next.js 可获得基础设施控制、合并项目并支持服务器端功能,同时保留 Vercel 的大部分优势,如 HTTPS、回滚和构建。
问题
Users want to run Next.js on their own VPS instead of Vercel to control infrastructure, consolidate projects, or use server‑side features.
结果
Self‑hosting Next.js on a VPS replicates most Vercel features—build, URL, HTTPS, rollback—while giving full control over infrastructure and avoiding per‑PR preview URLs.
工作流
- Prepare the server: add user, install nginx, git, Node, and PM2
- Clone the repo, copy .env.example to .env.production, install deps, build the app
- Start the app with PM2 and save the process list
- Configure Nginx reverse proxy to forward to the app port
- Obtain and install an HTTPS certificate with Certbot
- Plan and implement a safe rollback strategy using release directories
证据
Vercel is the smoothest way to ship Next.js. Connect a repo, push, and you have a URL with HTTPS.
This guide shows how to self-host a Next.js app on a Linux VPS, first the manual way, then the shortcut with ShipOwn.
If preview deployments and edge locations are core to your workflow, stay on Vercel. If you mostly need "a fast server running my app on my domain", a VPS is enough.
Build the app: su - deploy git clone https://github.com/you/next-app.git && cd next-app cp .env.example .env.production # fill in real values npm ci && npm run build
pm2 start npm --name next-app -- start -- -p 3000 pm2 save && pm2 startup
sudo apt install -y certbot python3-certbot-nginx sudo certbot --nginx -d app.example.com
ShipOwn is a desktop app (Windows, macOS, Linux) that does the same job over SSH, without installing a deployment agent on your server.
- 记录日期: 2026-11-01T14:43:43.962Z