Deploying a frontity react site on DigitalOcean

Proposed Solution : Deploying a frontity based react js website on custom installed Ubuntu,NodeJs and allowing multiple websites to run on different ports of same instance.

This article assumes that you have installed Ubuntu, NodeJs, Nginx. If It’s not preinstalled, follow this article to install it.

SSH into the server using you credentials or key.

Run following command :
sudo mkdir -p /var/www/html/example.com
sudo chown -R $USER:$USER /var/www/html/example.com
sudo chmod -R 755 /var/www/html
sudo cp /etc/nginx/sites-available/test.conf /etc/nginx/sites-available/example.com

insert proper settings in test.conf and create a new js file called project-serve.js

Run following commands

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo cd /var/www/html/example.com

Upload all code files to /var/www/html/example.com folder using FTP or SSH. Then run 
npm install
sudo npx frontity build
sudo -u nodejs pm2 start project-serve.js
sudo -u nodejs pm2 save
sudo systemctl restart nginx