Creating a Node.js application
- Log in to cPanel.
- In the Software section, click Setup Node.js App.
- Click Create Application and complete the form:
- Node.js version: pick the version your app requires.
- Application mode: Development or Production.
- Application root: the folder containing your app (e.g. nodeapp), relative to your home directory.
- Application URL: the domain or subdomain/path where the app is served.
- Application startup file: your entry point (e.g. app.js or server.js).
- Click Create.
A minimal example app
Create app.js in your application root:Passenger sets the port — always listen on process.env.PORT rather than a hard-coded port.
Installing dependencies
After uploading your package.json:- On the app’s row in Setup Node.js App, click Run NPM Install, or
- Connect via SSH, enter the app’s virtual environment (the command is shown at the top of the app’s edit page — it looks like
source /home/user/nodevenv/nodeapp/18/bin/activate), and runnpm install.
Managing the application
From Setup Node.js App you can:- Restart the app after deploying new code
- Stop/Start the app
- Set environment variables (e.g. NODE_ENV, API keys)
- Change the Node.js version
Troubleshooting
- Check the stderr.log in the application root for startup errors.
- “503” or Passenger error pages usually mean the app crashed on boot — the log tells you why.
- After any code change, click Restart.