Websites & apps

Host a Node.js app in cPanel with Setup Node.js App

Deploy an Express or other Node.js application on cPanel hosting with Setup Node.js App: choose the Node version, set the startup file, install npm packages and restart.

IntermediatecPanel hosting2 min read

cPanel hosting on CloudLinux can run Node.js applications alongside PHP sites. The Setup Node.js App tool creates an isolated environment, connects it to a domain or path, and keeps the app running behind the web server through Phusion Passenger. You do not need to manage ports or a process manager yourself.

Before you start

  • Your app's code with a package.json and a start file such as app.js or server.js.
  • The domain or subdomain for the app, already added in cPanel. A subdomain like app.example.com keeps it separate from your main site. See create a subdomain.
  • Optional: SSH access or Terminal for running npm commands.

Create the application

  1. Open cPanel → Software → Setup Node.js App and click Create Application.
  2. Node.js version: pick the version your app needs, preferably a current LTS release.
  3. Application mode: Production (sets NODE_ENV=production).
  4. Application root: a folder in your home directory for the code, e.g. apps/myapp. Keep it outside public_html so source files are not downloadable.
  5. Application URL: choose the domain and optionally a path.
  6. Application startup file: e.g. app.js.
  7. Add Environment variables such as DATABASE_URL or API keys.
  8. Click Create. cPanel creates the folder with a test app and starts it.

Upload code and install packages

  1. Upload your files into the application root with File Manager, FTP or Git Version Control. Do not upload node_modules.
  2. Back in Setup Node.js App, click the pencil (edit) icon on the app. Click Run NPM Install. It installs dependencies from package.json.
  3. Or in Terminal, copy the command shown at the top of the app page (it looks like source /home/user/nodevenv/apps/myapp/20/bin/activate && cd /home/user/apps/myapp), run it, then run npm install or build steps such as npm run build.
  4. Click Restart.

How your app should listen

Passenger tells the app which port or socket to use. Use the standard environment variable instead of a fixed port:

const port = process.env.PORT || 3000;
app.listen(port);

Do not start the app with node app.js & or PM2 on shared hosting; those processes are stopped and do not receive web traffic.

Warning: Node.js apps count toward your CloudLinux CPU and memory limits. Heavy build steps such as large Next.js builds are better done on your computer; upload the built output.

Logs and restarts

  • After every code change, click Restart (or create tmp/restart.txt in the app root).
  • Set Passenger log file in the app settings (e.g. logs/passenger.log) to see startup errors and console.log output.
  • Stop App pauses it; Destroy removes the environment (not your files).

Troubleshooting

  • "We're sorry, but something went wrong" / 503: the app crashed on start. Read the Passenger log; usually a missing package or wrong startup file.
  • Cannot find module: run NPM Install again in the correct Node version.
  • Static files 404: serve them with express.static or put them in the domain's public folder.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.