we create a public ip available vm instance template so that we can make a load balance cloing the publically setted template.
cd /etc/nginx
ls
sudo nano nginx.conf
change this conf file as needed :
`events { # empty placeholder }
http {
server {
listen 80;
location / {
proxy_pass http:https://frontend-raihan;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http:https://backend-raihan;
}
}
upstream frontend-raihan {
server 11.10.10.12:80;
server 13.10.10.14:80;
}
upstream backend-raihan {
server 10.10.0.5:8000;
server 11.10.10.6:8080;
}
}`
location /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http:https://backend-raihan; }
upstream backend-raihan { server 10.10.0.5:8000; server 11.10.10.6:8080; }
set two backend there so that whenever you have huge request it will auto transfer user to other one.
https://github.com/nodesource/distributions
take v-16 binary version- sudo corepack enable to enable yarn
- clone this to there
yarn
npm install
npm run dev
- open BaseUrl.js file and change the port for backend.