i built react app which is running on node server, i'm using multiple submain in same gcloud instance.using pm2 i'm running those app which works fine on different ports.
right now i want to implement nginx on my vm so i can target those apps with specif domain.
my servers.conf(nginx file)
server {
listen 80;
listen [::]:80;
server_name booking.stanplus.com www.booking.stanplus.com;
return 301 https://booking.stanplus.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name booking.stanplus.com www.booking.stanplus.com;
ssl_certificate /etc/letsencrypt/live/booking.stanplus.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/booking.stanplus.com/privkey.pem;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass https://35.237.131.149:8080;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
listen [::]:80;
server_name dkiosk.stanplus.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
}
}
http://dkiosk.stanplus.com working fine but https://booking.stanplus.com/ got ssl but not working.
https://booking.stanplus.com/ is targeting on http://35.237.131.149:8080/ which is working fine.
https://booking.stanplus.com/ giving me error
502 Bad Gateway
where i'm doing wrong...?,first time i'm implementing nginx.
i looked lot of articles and Q&S but get confessed.
plz help me.i'm stuck since 3days.