Reverse Proxy Nginx on Ubuntu 20 -Adonis JS Deployment using PM2

Cerwyn Cahyono
3 min readJan 4, 2022
https://www.nginx.com

Nginx is one of the most popular web servers in the world today, besides the Apache. One of the reasons Nginx is popular is because it’s very lightweight and has a better performance at handling a lot of connections at the same time. Also, deploying a Javascript app (that’s also a popular technology these days) using the reverse proxy is very straightforward and simple

So in this article, I’ll show you how to set up the Ubuntu 20 server from scratch, and try to deploy the Adonis JS framework as the use case using PM2 for the process manager and reverse proxy in Nginx.

Content Overview

  • Server Environment Setup
  • PM2 Ecosystem & Nginx

#1 Server Environment Setup

First thing first, let’s set up the environment by installing some required packages. For this article, I’ll be using node 16 and npm 6.

curl -sL https://deb.nodesource.com/setup_14.x -o setup_14.sh
sudo sh ./setup_14.sh
sudo apt update
sudo apt install nodejs

After the installation, we can verify the versions.

node -v
npm -v

After that, let’s install the Nginx and PM2.

sudo apt install nginx
sudo npm…

--

--

Cerwyn Cahyono

PHP/Backend Engineer at Undercurrent Capital Pte Ltd — Data Science Enthusiast