Skip to content

How to Host a Node.js Application in cPanel (Step by Step)

Host a Node.js app in cPanel step by step: create the app, pick a supported Node.js version, upload files, run npm install and restart. Fixes for common errors included.

By Bishal KC, Fullstack Developer | Technical Engineer · · 10 min read

See web hosting plans

How to Host a Node.js Application in cPanel (Step by Step)

Table of contents

Key takeaways

  • Open Setup Node.js App in the Software section of cPanel, click Create Application and choose Production mode.
  • Pick a supported Node.js LTS version. Node.js 20 has reached end of life, so use 22, 24 or 26.
  • Keep the application root outside public_html and the startup file relative to it, such as src/server.js.
  • Upload your files without node_modules, then click Run NPM Install and Restart.
  • After changing the Node.js version, run npm install again and restart so native packages are rebuilt.
  • For background workers or root access, use a VPS instead of cPanel.

You can host a Node.js application in cPanel without renting a server. cPanel's Setup Node.js App tool creates an isolated Node.js environment, points a domain or sub-folder at your app, installs your npm packages and restarts the app with one click. This guide shows how to deploy a Node.js app on cPanel from start to finish, how to choose a supported Node.js version, and how to fix the errors people hit most, with a screenshot for every step.

The screenshots come from a real Baddas Cloud cPanel account. The same screens appear on any cPanel host that has the Node.js tool turned on.

Quick answer: how to host a Node.js app in cPanel

  1. Login to your cPanel if have or buy Nodejs Hosting in Nepal from Baddas Cloud.

  2. Open Setup Node.js App in the Software section and click Create Application.

  3. Choose a supported Node.js version, the Production mode, an application root outside public_html, the URL and your startup file (for example app.js).

  4. Upload your project (without node_modules) to the application root.

  5. Click Run NPM Install, then Restart, and open your URL.

What you need before you start

  • A cPanel account where Setup Node.js App is available (you find it in the Software section). On a host that does not show it, ask support whether your plan includes Node.js.

  • A Node.js app that starts from one file, such as app.js, with a package.json that lists your dependencies.

  • A domain or sub-domain already added to the account.

  • Your files as a .zip, without the node_modules folder. The server installs those for you in step 6.

Make sure the app does not hard-code a port. On cPanel the app server (Passenger) decides how requests reach your app, so the usual Express line works:

JavaScript
const express = require('express');
const app = express();

app.get('/', (req, res) => res.send('Hello from Node.js on cPanel'));

app.listen(process.env.PORT || 3000);

Also add a start script to package.json, so the same project runs on your laptop and on the server:

JSON
{
  "name": "my-node-app",
  "version": "1.0.0",
  "main": "app.js",
  "scripts": { "start": "node app.js" },
  "engines": { "node": ">=22" },
  "dependencies": { "express": "^5.0.0" }
}

Which Node.js version should you use in cPanel?

Node.js releases a new major version about every year, and each one is supported for a limited time. Running a version that is past its end of life means no security fixes, so pick one that is still supported. At Baddas Cloud we keep the Node.js versions on supported release lines up to date with the latest patch releases, and you choose the version for each app in Setup Node.js App.

Node.js version

Codename

Status on nodejs.org (20 November 2026)

What to do

26

Lithium

LTS

A good choice for new apps.

24

Krypton

LTS

A safe default for most apps.

22

Jod

LTS

Fine for existing apps. Plan the move to a newer LTS.

20

Iron

End of life

Upgrade. It no longer gets security fixes.

25 and older odd-numbered versions

None

End of life

Do not use for production.

27

None

Alpha

For testing only, not for a live site.

LTS means long-term support: the version gets bug and security fixes for about 30 months. Support dates change over time, so check the Node.js release schedule before you choose.

How to check and change the Node.js version of your app

  1. In Setup Node.js App, open your app with the pencil icon. The version is shown in the Node.js version list.

  2. Pick a different version, click Save, and wait for the app to be updated.

  3. Click Run NPM Install again. Packages that compile native code, such as bcrypt or sharp, must be rebuilt for the new version.

  4. Click Restart and test your app.

To confirm the version your code really runs on, enter the app's environment in the cPanel Terminal (the command is shown at the top of the app page) and run node -v. Set "engines" in package.json, as in the example above, so anyone deploying the project knows which versions it supports.

How to host a Node.js application in cPanel, step by step

Step 1: Open Setup Node.js App in cPanel

Log in to cPanel and scroll to the Software section or Search Nodejs Setup at Top right. Click Setup Node.js App. If you cannot find it, use the search box at the top and type "Node".

Setup Node.js App icon in the Software section of the cPanel dashboard

Step 2: Click Create Application

The Node.js page lists every app on your account, with its address, folder, mode and status. Click Create Application in the top right corner. A new account shows an empty list.

cPanel Node.js selector page with the Create Application button and a running app in the list

Step 3: Fill in the application settings

Fill in the form. These five fields decide how your app runs:

Field

What to enter

Example

Node.js version

A supported LTS version your app was built for. See the table above.

24.x

Application mode

Production for a live site, Development while you test. It sets the NODE_ENV variable.

Production

Application root

The folder for your app files. Use a folder in your home directory, not inside public_html.

my-node-app

Application URL

The domain, and an optional path, where the app is served.

yourdomain.com/my-node-app

Application startup file

The file that starts your app, with its path from the application root. If it sits in a sub-folder, include the folder.

app.js or src/server.js

Create Application form in cPanel with Node.js version, Production mode, application root, URL and app.js startup file filled in

The startup file is relative to the application root. If your project keeps its entry file in a src folder, type src/server.js instead of app.js. The root folder itself is only the folder that holds package.json.

The red box at the top right is the Create button. You press it after step 4.

Keep the application root outside public_html. Your source code and .env-style files then are never served as public files.

Step 4: Add environment variables (optional)

Use Add Variable for settings that should not live in your code, such as database details or API keys. Enter the name and value, then click Done. Your code reads them with process.env.NAME. The PORT variable in the screenshot is only a sample, because Passenger picks the real port for you.

Adding an environment variable name and value in the cPanel Node.js application settings

When everything looks right, click Create at the top. cPanel makes the app folder and a Node.js environment for it.

Step 5: Upload your Node.js files

Go back to the cPanel home page and open File Manager in the Files section. Open your application root folder, click Upload and add your .zip, then right-click it and choose Extract. Check that app.js and package.json sit directly in the application root, not inside another folder.

File Manager icon in the cPanel Files section used to upload Node.js app files

You can also upload with FTP. The folder must end up the same.

Deploy from Git instead (optional). If your code is in a Git repository, open Git Version Control in cPanel, create a repository that clones your remote into the application root, and pull new commits whenever you release. After each pull, run Run NPM Install if your dependencies changed and click Restart. Keep node_modules and your .env file out of the repository with a .gitignore.

Step 6: Run NPM Install

Open your app from the Node.js page (the pencil icon). Once cPanel finds your package.json, the Run NPM Install button appears under "Detected configuration files". Click it. cPanel installs every dependency inside the app's own environment, so you never upload node_modules.

Run NPM Install button under detected configuration files for a Node.js app in cPanel

Step 7: Restart the app and open it

At the top of the same page, click Restart (or Start App if it is stopped). Wait for the status to show "started", then open your Application URL in the browser. You should see your app's response.

Stop App and Restart buttons on a Node.js application page in cPanel

Click Save whenever you change a setting on this page. Changing the Node.js version or the startup file needs a Save and then a Restart.

Use your own domain and HTTPS

Choose your domain or sub-domain in the Application URL list, and your app is served on it. A sub-domain such as api.yourdomain.com is a clean way to run an API next to your main website. Make sure the domain has an SSL certificate so the app loads over HTTPS. Every Baddas Cloud plan includes free SSL. In your code, trust the proxy header if you read the visitor's address or protocol, for example app.set('trust proxy', 1) in Express.

Update your Node.js app later

  1. Upload the changed files to the application root and overwrite the old ones, or pull from Git.

  2. If you changed package.json, click Run NPM Install again.

  3. Click Restart. The app keeps running the old code until you restart it.

Run commands in the terminal

At the top of the app page, cPanel shows a command that starts with source and ends with your app folder. Run it in the cPanel Terminal or over SSH to enter the app's Node.js environment. From there node and npm use the version you picked, so you can run npm run build, a database migration or node -v.

Security and speed checklist for a Node.js app on cPanel

  • Keep secrets out of the code. Use environment variables and never commit a .env file.

  • Keep the application root outside public_html.

  • Use Production mode for a live site, so frameworks such as Express turn on their faster settings.

  • Update packages. Run npm audit in the terminal now and then and update packages with known problems.

  • Stay on a supported Node.js version so you keep getting security fixes.

  • Serve static files efficiently. Put large images and downloads on the normal website folder or a CDN, and let Node.js handle only dynamic requests.

  • Log errors, not secrets. Check your domain's error log in cPanel when something fails.

Fix common errors when you host Node.js in cPanel

What you see

Likely cause

Fix

503 or "Incomplete response" page

The app crashed on start

Check the startup file name and run node app.js in the terminal to see the error.

"Cannot GET /"

The app runs, but has no route for that path, or the Application URL has a sub-folder your routes do not know about

Add a route for / and match the URL on the app page to the routes in your code.

"Cannot find module"

Dependencies are not installed

Click Run NPM Install, then Restart.

"The engine node is incompatible" or a syntax error on modern code

The app uses newer features than the Node.js version you picked

Choose a newer LTS version in Setup Node.js App, Save, Run NPM Install and Restart.

Native package fails after changing version

It was built for the old Node.js version

Click Run NPM Install again to rebuild it.

Old page or old output after an upload

The app was not restarted

Click Restart.

App stops under load or is killed

The account hit its memory or process limit

Lower memory use or move to a larger plan or a VPS.

Node.js on cPanel or on a VPS: which should you pick?

Node.js on cPanel hosting

Node.js on a VPS

Best for

Websites, REST APIs, webhooks and small back ends

Workers, queues, WebSockets at scale and custom services

Setup

A few clicks in Setup Node.js App

You install and secure the server yourself

Restarts and updates

Handled by the app server

You run a process manager such as PM2

Root access

No

Yes

Cost

Lower

Higher

Host your Node.js app with Baddas Cloud

Baddas Cloud Node.js hosting in Nepal gives you Setup Node.js App in cPanel, your choice of supported Node.js version, free SSL, daily backups and free migration. It comes in three plans, Standard, Developer and Professional, and the price you see is the price you renew at. Running Flask or Django instead? See Python hosting in Nepal.

If your app needs a worker that never stops or full root access, look at Nepal-based VPS hosting. If you are moving an app from another host, free website migration can copy it for you. Not sure whether a plan fits? Ask us before you buy.

  • nodejs
  • cpanel
  • nodejs hosting
  • deploy nodejs app
  • host nodejs app in cpanel
  • nodejs hosting guide
  • what is nodejs lts

Frequently asked questions

Can I host a Node.js app on cPanel shared hosting?

Yes, if your host has turned on the Setup Node.js App tool for your plan. You find it in the Software section of cPanel. If you do not see it, ask your host whether your plan includes Node.js.

Which Node.js version should I use in cPanel?

Use a supported long-term support (LTS) version. On 20 November 2026 the Node.js release page lists versions 22, 24 and 26 as LTS and version 20 as end of life, so choose 24 or 26 for new apps. Check the Node.js release schedule because support dates change.

How do I change the Node.js version of my app in cPanel?

Open the app in Setup Node.js App, pick another version in the Node.js version list, click Save, click Run NPM Install so native packages are rebuilt, then click Restart.

Does Baddas Cloud keep Node.js versions up to date?

Yes. We keep the Node.js versions on supported release lines up to date with the latest patch releases, and you choose the version for each app.

Do I need to upload the node_modules folder?

No. Upload your package.json and click Run NPM Install on the app page. cPanel installs the packages inside the app's own environment, which is faster and avoids version problems.

Where should I put my Node.js files in cPanel?

Put them in the application root you chose when creating the app, for example a folder called my-node-app in your home directory. Do not use public_html, because that folder is served as public files.

What should the application startup file be?

t is the file that starts your app, written relative to the application root: app.js if it sits in the root, or src/server.js if it is in a src folder.

Why does my Node.js app show a 503 error after I deploy it?

The app most likely crashed on start. Check that the startup file name is correct, that Run NPM Install finished and that your code does not hard-code a port. Run the startup file in the cPanel Terminal to read the exact error.

Why do I see "Cannot GET /" on my Node.js app?

The app is running, but it has no route for that path. Add a route for / and make sure the Application URL in cPanel matches the routes in your code, especially if the app is served from a sub-folder.

Can I run Express, Fastify or Next.js on cPanel?

Express and Fastify work well because they start from one file and answer web requests. Frameworks with a build step, such as Next.js, need a custom server file and enough memory, so a VPS is often easier for them.

Sources

  1. Node.js release schedule (opens in a new tab)
  2. Express "Hello world" example: (opens in a new tab)

About the author

Bishal KC

Fullstack Developer | Technical Engineer

← All guides

Web hosting for your website

See what each plan includes, with unlimited websites, storage and bandwidth on every plan.

View plans