Next.js deploy guide
Run Next.js as a Node.js server when you need SSR / API routes / ISR, or export static files with output: 'export'.
- Build
- npm run build
- Output
- .next(SSR)/ out(静态导出 output: 'export')
- Official docs
- Next.js Deploying · Static Exports · OpenNext for Cloudflare
How to deploy
- Static: set output: 'export', run npm run build and upload out/.
- Node.js / VPS: npm run build then npm run start (port 3000), keep it alive with PM2 or systemd behind Nginx.
- Docker: see the official Docker guidance; output: 'standalone' keeps images small.
Per platform
| Platform | Notes |
|---|---|
| Vercel | Native support; import the repo. |
| Cloudflare | Pages for static export; Workers + OpenNext for SSR. |
| VPS | Node.js + PM2/systemd + Nginx, or Docker. |
Notes
- Static export does not support server-only features; see the Static Exports docs.
- For Cloudflare Workers use the OpenNext Cloudflare adapter.