[https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04](Install Nginx)
[https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04](Configure PM2)
sudo apt-get update -y
sudo apt-get install build-essential -y
sudo apt-get install nginx -y
sudo ufw allow 'Nginx Full'
sudo ufw status
# install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 10.15.0
npm i pm2 -g
# launch pm2 on server boots, then follow instruction
pm2 startup systemd
# run pm2 with npm start
# pm2 start npm -- start
# genere ssh
ssh-keygen
nginx create a proxy create a file in /etc/sites-available/api.domain.com
Link it to enable the site
Test nginx conf
Restart nginx