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/
sudo chown -R $USER:$USER /var/www/html/
sudo chmod -R 755 /var/www/html
sudo cp /etc/nginx/sites-available/test.conf /etc/nginx/sites-available/

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/ /etc/nginx/sites-enabled/
sudo cd /var/www/html/

Upload all code files to /var/www/html/ 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