How to install a Node.js application in cPanel


In this article, we will explore the process of setting up a Node.js application on a cPanel account.


To install a Node.js application follow the below steps:

  1. Log in to the server as the cPanel user via SSH or ‘Terminal’ in cPanel.
  2. Create the application’s directory relative to the user’s home directory using the following command:
    • mkdir nodejsapp
  3. Change to the application’s directory.
    • cd nodejsapp
  4. Create the app.js file with a text editor. It is strongly recommended that you create the file with this exact name because Passenger searches for this filename when it executes.
  5. Add the application’s configuration to the app.js file. This will resemble the following example:
const http = require('http')
const hostname = '';
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}/`);

Save app.js file and close the editor.

Please note after installing that application, it must be registered in cPanel with “Application Manager“.

cPanel cPanel Guides Web Hosting Discussion