[question updated] mup nginx 502 error

I’ve deployed my app and installed nginx in my server

and added following configuration to /etc/nginx/conf.d/app.conf

server {
        server_name www.app.com;
        return 301 $scheme://app.com$request_uri;
}
server {
 listen 80;
 server_name app.com;

 location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
 }
}

After this I restarted the nginx server

sudo service nginx restart

returned ok status but I’m getting 502 bad gateway error

what is missing in my configuration, If I stop the nginx server normal app deployed by mup is working fine

Pretty sure you’re missing the port in the ENV variables.
Add: "PORT": 3000

edit: actually it might default to 3000 anyway…

Interestingly if I give "PORT": 3000 option in mup environment variable, the app is not runnig with or withoug nginx

It is throwing same error
/uploads/default/original/2X/4/48f300b4ae05e8653e43bdb007adc1f482e53ffb.png

@arunoda, any help here