How to Install a Node.js Application in cPanel

This guide explains how to install, test, register, restart, and troubleshoot a Node.js application in cPanel. It covers EasyApache 4 requirements, creating the app.js file, running the application, registering it in Application Manager, creating a custom startup file, and resolving common issues.

Node.jsPassenger Node.jsNode.js cPanel

~2 min read • Updated Feb 21, 2026

1. Overview


Warning: Because WebPros International, LLC does not develop Node.js, cPanel Technical Support cannot assist with these steps. Only experienced system administrators should perform this process. All steps must be performed as a cPanel user, not as root.


This guide explains how to install a Node.js web application. Node.js is a JavaScript runtime for building scalable applications.


You may also perform these steps in cPanel’s Terminal interface.


In this document, nodejsapp represents the application name and 3000 represents an open firewall port.


2. Pre‑Installation Requirements


Your hosting provider must install the appropriate EasyApache 4 packages.


2.1 AlmaLinux 8 / Rocky Linux 8


Required:

  • ea-ruby27-mod_passenger
  • ea-apache24-mod_env

One Node.js version:

  • ea-nodejs16
  • ea-nodejs18
  • ea-nodejs20
  • ea-nodejs22

2.2 AlmaLinux 9 / Rocky Linux 9


  • ea-apache24-mod-passenger
  • ea-apache24-mod_env

2.3 CentOS 7


  • ea-ruby27-mod_passenger
  • ea-apache24-mod_env
  • ea-nodejs16

Note: This guide does not apply to Ubuntu servers.




3. Install the Node.js Application


3.1 Create the Application Directory


Log in via SSH as a cPanel user and run:


mkdir nodejsapp

Then enter the directory.


3.2 Create the app.js File


Important: Passenger searches for app.js by default. If you use a different filename, you must configure it manually in Apache.


Example app.js file:


const http = require('http')
const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World! NodeJS \n');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});



4. Test the Application


Start the application:


/opt/cpanel/ea-nodejs20/bin/node app.js

Expected output:


Server running at http://127.0.0.1:3000


In another terminal:


curl http://127.0.0.1:3000

Expected output:


Hello World! NodeJS


To stop the application:


ps aux | grep app.js
kill -9 PIDNUMBER



5. Register the Application


Use:


cPanel » Home » Software » Application Manager


After registration, access the application at:


http://example.com/nodejsapp




6. Restart the Application


Create a restart.txt file inside the tmp directory:


nodejsapp/tmp/restart.txt

Passenger restarts the application when this file is touched.




7. Create a Custom Startup File


If your startup file is not app.js, you must define it in Apache.


Create:


/etc/apache2/conf.d/userdata/ssl/2_4/user/domain.nodejs.conf


Example content:


DocumentRoot /user/example.com/public
PassengerStartupFile index.js
PassengerAppType node
PassengerAppRoot /nodejsapp/example.com

Rebuild and restart Apache:


/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_httpd



8. Troubleshooting


Error logs are located in:


/home/user/nodejsapp/logs


For port issues, refer to Passenger’s reverse port binding documentation.




Conclusion


This guide covers all steps required to install, test, register, restart, and troubleshoot Node.js applications in cPanel. Following these instructions ensures stable and secure deployment of Node.js applications on your hosting environment.


Written & researched by Dr. Shahin Siami