
Complete Guide to Setting Up a Node.js Environment in cPanel
Complete Guide to Setting Up a Node.js Environment in cPanel
Overview
This guide will walk you through the process of setting up a Node.js environment using the cPanel interface, ideal for Hiverift hosting or any provider with Node.js support through cPanel.
Requirements
- cPanel account with Node.js support
- Uploaded Node.js project files (including
package.json
) - Basic familiarity with file structures and npm
Step 1: Access cPanel
- Login at https://yourdomain.com/cpanel
- Navigate to Setup Node.js App (or Application Manager)
Step 2: Create a New Node.js Application
- Click Create Application
- Configure the following settings:
- Node.js version: Select the desired version
- Application Mode: Set to
Production
- Application Root: e.g.,
my-node-app
- Application URL: e.g.,
https://yourdomain.com/app
- Startup File: e.g.,
index.js
- Click Create
Step 3: Upload or Edit Your Files
- Open File Manager from cPanel
- Navigate to your application root directory
- Upload or create files including:
index.js
orapp.js
package.json
Step 4: Install Dependencies
- Back in Application Manager, find your app
- Click Open Terminal (or use SSH if available)
- Navigate to the app directory:
cd my-node-app
- Run:
npm install
Step 5: Start or Restart the Application
Return to the Application Manager and click Restart. Your app will now run and be accessible via the configured URL.
Tip: Make sure your app listens to the environment port:
const port = process.env.PORT || 3000;
Optional: Manage Environment Variables
- Click Edit on your Node.js app
- Scroll to Environment Variables
- Add variables like:
DB_HOST
=localhost
NODE_ENV
=production
Need Help?
Contact dev@hiverift.com for Node.js setup assistance on Hiverift hosting.