Skip to main content
Updated: August 9, 2026
Matic Bončina
By Matic BončinaFounder
Review pending
Next.js doesn’t ship with a Passenger-compatible startup by default. The fix: a custom server that exports a Node http handler. For the underlying tool, see Node.js.

Before you begin

  • A Node.js app already created in cPanel, version 22 or 24. Node 20 is EOL and shouldn’t be used for a new deploy.
  • The app root contains your Next project (package.json, pages/ or app/, next.config.js).
  • SSH access (recommended for builds).

Build for production

A Next build is memory-hungry and can OOM when run from the cPanel UI, even on plans with several GB. Build over SSH:
Check next is in dependencies, not devDependencies.

Add a Passenger-compatible server

1

Create server.js in the app root

server.js
2

Set the startup file

In cPanel, open Setup Node.js App, click your app to open its management page, set Application startup file to server.js, then click Save.
3

Restart

Click Restart, or touch ~/myapp/tmp/restart.txt.

Common issues

Move next from devDependencies into dependencies and re-run npm install.
Build on a dev machine instead, then rsync .next/ and public/ up. Skip building on the server entirely.
The custom server above hands every request to Next. If you wrap routes in custom Express middleware, make sure the catch-all delegates back to handle(req, res).

Need a hand?

Open a ticket

Best for anything that needs an account check or a config change on our end.

Live chat

Faster for quick questions during business hours.