How to Install and Setup Node.Js on CWP?

Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

Step 1: Install Prerequisites:

yum groupinstall 'Development Tools' -y

Step 2: Install Yum Repository

NodeJS 12.x:

curl -sL | bash -

NodeJS 11.x:

curl -sL | bash -

NodeJS 10.x:

curl -sL | bash -

NodeJS 8.x:

curl -sL | bash -

Step 3: Install Nodejs and npm

yum install -y nodejs

Step 4: Confirm installation:

Run the below commands to check if nodejs is installed properly:

node -v
npm -v

The above command should output the version of nodejs and npm installed. For example, for version 12.X, you should see something like below:

[root@cwp2 ~]# node -v
[root@cwp2 ~]# npm -v

npm which is the package manager for nodejs can be used to search and install additional modules for nodejs.

npm search &ltpackage&gt
npm install &ltpackage&gt

Step 5: Setup webserver to host Nodejs Application

These options depend on the webservers you have currently installed

Example if you have installed nginx/varnish/apache you can use:

i. nginx -> custom port – This will proxy directly to nodejs Application(RECOMMENDED)

ii. nginx/varnish -> custom port – This will proxy to varnish cache and then to nodejs Application

iii. nginx/varnish/apache -> custom port – This will proxy to varnish cache and then to apache and then to nodejs Application

Configure webservers for domain to be used for nodejs Application:


CWP.Admin left Menu -> Webserver settings -> Webserver Domain Conf -> Select Username -> Select Domain/Subdomain -> create configuration -> select any option with (custom port) -> check the box – Rebuild webserver conf for domain on save -> Enter port number you have used in the application for the custom port, leave IP as -> save changes

Step 6: Install AutoSSL

CWP.Admin left Menu -> Webserver settings -> SSL Certificates -> AutoSSL -> select user and domain -> install SSL

Leave a Reply

Your email address will not be published. Required fields are marked *