why use Nginx?

Setup - Starting State

End State

The process

Map Your dns record to your public IP

Install ngnix web server

Why do we need nginx ?

Install nginx by running apt-get install nginx

create a file /etc/nginx/sites-available/dubscale.conf and write the following config

server {
    server_name dubscale.com;
    port 80
    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}
             

and create a soft link in /etc/nginx/sites-enabled/dubscale.conf This means that server is accepting traffic only at port 80 and from dubscale.com and redirecting it to localhost at port 3000. Now, run the webapp at port 3000 with non-sudo user. Start nginx server by running sudo service nginx start

Install certbot

Now, we will install certbot and configure ssl certificate to enable SSL certificate to the end user.