How to Set Up Node.js Application in cPanel Hosting?
What is Node.js?
Node.js is a powerful, open-source JavaScript runtime built on Chrome's V8 engine that allows you to run JavaScript on the server side. It’s widely used for building fast, scalable web applications, real-time systems like chat apps, APIs, and dynamic websites.
At GB Network Solutions, we’re always focused on giving developers, startups, and business owners the flexibility to run their web applications with ease. If you're building modern web apps, APIs, or real-time systems using Node.js, you’ll be glad to know that our hosting environment supports Node.js.
Benefits of Hosting Node.js
- Easy Setup via cPanel – No command-line experience needed.
- Multiple Versions Supported – Choose the version that matches your app.
- Flexible App Management – Quickly restart, update, or debug your app from the browser.
- npm Support – Easily install your project dependencies.
- Great for Modern Web Apps – Ideal for Express, Next.js, APIs, and more.
Prerequisites
Before you begin:
- You are using Startup or Business Web Hosting plans (cPanel and Node.js are included by default) or Linux KVM VPS / Dedicated Server plan with cPanel and CloudLinux added as an addon.
- You have already created a domain or subdomain in your cPanel account. If you plan to deploy your Node.js application on your main domain, you can proceed with the setup as usual. However, if you intend to deploy your app on an addon domain or subdomain, please make sure the domain has been properly created in cPanel beforehand. Please refer to our step-by-step guide: How To Add An Addon Domain In cPanel and How To Create a Subdomain in cPanel.
- Your Node.js application files are uploaded to your hosting account.
Step-by-Step: Set Up Node.js in cPanel
- Login into your cPanel using the username and password provided. You can retrieve your cPanel credentials from your registered email once you have subscribed to our plans.
- Inside cPanel, scroll down to the Software section and click “Setup Node.js App”.
- Click “Create Application”.
- Configure the following:
- Node.js Version – Select your required version (e.g., 22.x). Choose the latest stable version unless your app requires something specific.
- Application Mode – Set this to Production for live environments or Development if you’re still testing or debugging the application.
- Application Root – The Application Root is the file system location for your app’s files. This path is relative to your cPanel home directory, usually
/home/username/
. For example: - If you enter
myapp
, your full path becomes/home/username/myapp
- If you enter
apps/myapp
, the full path becomes/home/username/apps/myapp
- Application URL – Choose the domain or subdomain where you want your Node.js app to be accessible. This connects the selected domain/subdomain to your application root. For example, If you chose
myapp
as the application root and selectedapp.yourdomain.com
as the URL, accessinghttps://app.yourdomain.com
will load your Node.js app from/home/username/myapp
. - Application Startup File – This is the main file that runs your Node.js app. Common names include
app.js
,index.js
orserver.js
- Click "Create" to finish.
- The application will start automatically. To verify that it's running correctly, click “OPEN” to view the default test page in your browser.
- If the application is set up successfully, you’ll see a message that says: “It works!” displayed on the page.
Now that a working application is installed, you can customize and manage your app environment using the package.json
file along with the npm
package manager.
Choose Your Setup Path:
- I already have a Node.js app developed and ready to deploy
- I want to start a Node.js app from scratch on the server
If You Already Have a Node.js App Developed
Follow these steps if you’ve already built and tested your Node.js app on your local machine:
- Use File Manager to upload all your app files including:
package.json
.env
- Any required folders and files
- Upload them to the folder you set as your Application Root during app creation. Access your cPanel using the credentials provided by GB Network Solutions.
- Inside cPanel, scroll down to the Files section and click **“File Manager”. **A new tab or window will open, displaying your hosting file structure.
- In the left sidebar of File Manager, go to the directory you set as your Application Root during the Node.js app setup.
The Application Root is the file system location for your app’s files. This path is relative to your cPanel home directory,
usually/home/username/
. For example:
- If you entered
myapp
as the Application Root, your full path becomes/home/username/myapp
- If you entered
apps/myapp
, the full path becomes/home/username/apps/myapp
You may refer to this section - Step 4 if you are unsure your current Application Root.
- Click the Upload button in the top menu.
- In the upload page, click Select File or drag-and-drop files from your computer and upload the following:
package.json
.env
(if you use environment variables)- All your app files (e.g.,
app.js
,server.js
, folders likeroutes
,public
,views
, etc.)
Once uploaded, click Go Back to “/home/username/myapp” to return to File Manager.
- (Optional) If you uploaded a
.zip
file containing your app, right-click the.zip
file.. Select Extract and choose the current directory.
Now that you've uploaded and extracted your application files, the next step is to install the required Node.js dependencies. Proceed to the Install NPM Packages section to complete this part of the setup. This will ensure all the necessary modules listed in yourpackage.json
are properly installed within your hosting environment.
If You’re Starting a Node.js App From Scratch
Follow these steps if you haven't built your Node.js app yet and want to start directly on your hosting account using cPanel’s File Manager.
- Access your cPanel using the credentials provided by GB Network Solutions.
- Inside cPanel, scroll down to the Files section and click **“File Manager”. **A new tab or window will open, displaying your hosting file structure.
- In the left sidebar of File Manager, go to the directory you set as your Application Root during the Node.js app setup.
The Application Root is the file system location for your app’s files. This path is relative to your cPanel home directory,
usually/home/username/
. For example:
- If you entered
myapp
as the Application Root, your full path becomes/home/username/myapp
- If you entered
apps/myapp
, the full path becomes/home/username/apps/myapp
You may refer to this section - Step 4 if you are unsure your current Application Root.
- To begin, click the + File button located in the top-left corner of File Manager.
- When the dialog box appears, enter the filename as
package.json
and then click Create New File. - Next, find the newly created
package.json
file in the file list. Right-click on the file and choose Edit. A confirmation dialog will appear — click Edit to proceed to the editor.. Now we need to enter the content in the file editor.
The package.json
file is the core configuration file for any Node.js application. It defines important details about your app, including:
- App metadata – name, version, description, and author
- Main file – the JavaScript file your app runs from (e.g.,
app.js
,index.js
, orserver.js
) - Scripts – commands you can run using
npm
, like starting the app or running tests - Dependencies – packages your app needs to work, such as Express or Mongoose
Even for simple apps,package.json
helps you manage your project structure and is required to install packages vianpm
Here’s an example of a basicpackage.json
structure:
{
"name": "app",
"version": "1.0.0",
"description": "My App",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
- Once you've added the content, click Save Changes at the top-right corner, and then click Close to exit the editor.
ow that you’ve created the package.json file, the next step is to install the required Node.js dependencies. Proceed to the Install NPM Packages section to complete this part of the setup. This will ensure all the necessary modules listed in your
package.json
are properly installed within your hosting environment.
Install the NPM Packages
- Go back to the Node.js App section in cPanel.
- Click Edit next to your app.
- Click “Run NPM Install” to install dependencies from your
package.json
. - Once the process is complete, you will see a message NPM Install completed successfully. This indicates that all required packages have been installed into your application environment.
- After clicking Run NPM Install, your application’s dependencies will be installed. Once you see the message that NPM Install completed successfully, you can continue with additional setup steps, including create and configure the
.env
file. This file is where you’ll store sensitive configuration variables (e.g., API keys, database credentials) that your app can access securely. Depending on your app, you might need to configure other settings, like database connections, server configurations, or third-party services.
- Now that your Node.js app is up and running, it’s important to know how to manage it effectively.
- Restart the Application: If you make changes to your code or need to apply configuration updates, you can restart the application by clicking the Restart button in the Node.js Selector interface.
- Change Node.js Version: If you need to use a different version of Node.js, you can easily do so. Just stop your app, select a new version from the Node.js Selector **and **Save, and restart the app to apply the new version.
Setting up a Node.js application in cPanel is simple once you understand the flow — from preparing your hosting environment to deploying your app, installing dependencies, and managing your runtime settings. Whether you're deploying an app you’ve developed locally or building one from scratch directly on the server, our hosting provides a flexible interface to get started quickly.
By following this guide, you should now have a running Node.js app on your domain or subdomain. You’ve also learned how to manage it and update dependencies, giving you full control over your application hosting environment.
If you face any issues or need assistance, don’t hesitate to reach out — our support team is always ready to help!
🔧 Need help? Submit a Support Ticket
💬 **Chat with us on Live Chat via our ** website
Updated on: 21/04/2025
Thank you!