Skip to main content

Web traffic redirection with Node and Express on CentOS8

Shenzhen, China

Installing Node JS

Follow the instruction for your version of Node.js:

# As root
curl -sL https://rpm.nodesource.com/setup_14.x | bash -

# No root privileges 
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -

Run the following to install Node.js 14.x and npm:

sudo yum install -y nodejs

You may also need development tools to build native addons:

sudo yum install gcc-c++ make

Installing Greenlock Express

Greenlock Express is a Web Server with Fully Automated HTTPS and renewals.

mkdir /opt/web-redirection
cd /opt/web-redirection
npm init
npm install greenlock-express@v4

Installing Process Monitor 2

PM2 is a daemon process manager that will help you manage and keep your application online 24/7:

npm install pm2 -g