next start starts the application in production mode. The application must be compiled first with next build.
Options
The directory containing the Next.js application. Defaults to the current working directory.
Port number to listen on. Can also be set via the
PORT environment variable.Hostname to bind the server to.
Maximum time in milliseconds to wait before closing inactive keep-alive connections. Important when deploying behind a load balancer.
Enable CPU profiling via V8’s inspector. Profiles are saved to
.next/cpu-profiles/ on process exit.Show all available options.
Environment variables at start time
Environment variables loaded bynext start depend on where they are defined:
| Source | When loaded | Notes |
|---|---|---|
.env | Build time | Values baked into the bundle |
.env.local | Build time | Local overrides, not committed |
.env.production | Build time | Production-only values |
| System environment | Runtime | Set in your deployment platform or shell |
NEXT_PUBLIC_* variables are inlined at build time and cannot be changed at start time. Server-only variables (without the NEXT_PUBLIC_ prefix) can be changed between builds if you read them at request time.
PORT cannot be set in .env files. The HTTP server starts before environment files are loaded. Pass PORT as a system environment variable or use the -p flag.Examples
Start on a custom port
Bind to a specific hostname
Configure keep-alive timeout for a load balancer
When deploying behind a load balancer (e.g. AWS ELB/ALB), set the keep-alive timeout to a value greater than the load balancer’s idle timeout to prevent connection termination errors:CPU profiling
start-main-*.cpuprofile in .next/cpu-profiles/. Open them in Chrome DevTools under the Performance tab.
Serving a standalone build
If you built withoutput: 'standalone', use the generated minimal server instead of next start:
PORT and HOSTNAME environment variables:
Version history
| Version | Changes |
|---|---|
v15.0.0 | Turbopack stable for dev; next start unchanged |
v13.0.0 | App Router support added |
