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

~3 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

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue