How to deploy a Node.js application through cPanel ?

Pradip Bhattarai
3 min readSep 29, 2019
Deploy Node App

Node.js is an open-source, cross-stage JavaScript runtime environment for building up a different assortment of instruments and applications. No doubt Node.js can be used to build awesome applications but how can we deploy it in the server for production? Here, are some simple steps to deploy your node app using cPanel :

  1. Login to the hosting cPanel control panel and click on “Setup Nodejs App” button under the Software tab to access the NodeJS managing area.
Setup nodejs app

2. Click on the “Create Application” button at the top-right corner to create a new application.

Create Application

3. Fill out the details for the new application and click on the “Create” button at the top-right corner.

Node.js version — Select the Node.js version from the drop-down menu

Application mode — Choose application mode from the menu, either Production or Development

Application root — Specify the physical location to the application

Application URL — Specify the HTTP/HTTPS URL to the application

Application startup file — Specify the .js file name here

Create

Note: You also can set your application environment variables down there on option “ADD VARIABLE”

4. Once you have created the application, you can stop/restart/edit/remove the application via the interface.

Edit app

5. When clicking ‘Edit’ icon, you can make changes to the already created application including the variables you have set on it.

These are the options in the NodeJS application edit interface:

Stop/Restart application — You can stop/restart the application by click on that specific icon.

Destroy — To remove the NodeJS application

Run NPM Install — To install the package(s) mentioned in the packages.json file in the application root folder.

Run JS script — To run a command specified in packages.json file script section.

ADD VARIABLE — To add a variable for the application.

Edit created application

Note: After creating app for the first time, you need to compulsorily do “Run NPM Install” to install all included packages in your package.json file. Do not upload node_modules to root directly while uploading your application.

6. You can also alter other settings such as Node.js version, application mode/root/URL and the startup file.

Save edited app

Once you have made the changes, click on the “Save” button and restart the application once to take in effect.

Great !! You are good to go! Hope it helps!!

--

--