How to setup my NodeJs App

PART 1: Create Application on cPanel.

  • Request for Jailed SSH access
  • Upload through file manager or FTP into public_html
  • On your cPanel dashboard, click on Setup Nodejs App and click on Create Application


  • Select the Nodejs version best compatible with your application.
  • Select the mode you wish to run the application in, either production or development.
  • Set the application root to the location of your application

NOTE: Your files cannot be directly under public_html, so it should be in a subfolder e.g /home/user/public_html/myappfiles

  • Set your application URL, this is the URL where your application will load from.
  • Set your Application startup file to the full path to your app.js file. E.g /home/nodewghde/public_html/expressCart/app.js
  • Set the Passenger log file location where you wish to save error log from your application e.g. /home/nodewghde/logs/passenger.log
  • Click on Create.

 

PART 2: Install requirements, dependencies, and configure your application. (From cPanel)

  • After the application is created, it displays more details about the created application. If it doesn't for you, click on the edit icon
  • Click on NPM INSTALL to install all required modules for your application to run


  • Make necessary changes in your settings.json file such as site URL, DB configuration, and SMTP details where required.
  • Restart your application.

PART 2: Install requirements, dependencies and configure your application. (From ssh)

  • After the application is created, login to your cpanel account via SSH
  • From the details of the created application, copy the command to enter into the virtual environment. E.g

source /home/nodewghde/nodevenv/public_html/expressCart/10/bin/activate && cd /home/nodewghde/public_html/expressCart

 

  • In your virtual environment, run: npm install
  • When modules from npm install are done installing, Make necessary changes in your settings.json file such as site URL, DB configuration, and SMTP details where required.
  • Restart your application.
Was this article helpful?