I followed 502 Bad Gateway nginx : How to solve? but can not resolve my issue on Obsidian:
My localhost is listening on port 5000 - netstat -aon shows
and Apache is up and running - (checked with service apache2 status), Fail2Ban is not installed
nginx Proxy Mode is turned off, and an additional nginx directive is set:
When trying to post (e.g.) example.com/api/login the server responds with Bad Gateway 502.
The log (Websites & domains > Logs) shows
Any help in resolving the issue is greatly appreciated.
Further info:
The project is a MERN stack app, consisting of frontend and backend. Both parts are in separate folders under the same vhost-name. The frontend is reachable without any problem. The backend is a node-server (up and running). I tested to open the port 5000 directly and was able to work with it with a post to example.com:5000/api/login. I chose to setup node directly in the backend (and not via the Plesk interface), as I wanted to keep the separation between front- and backend.
My localhost is listening on port 5000 - netstat -aon shows
Code:
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN
nginx Proxy Mode is turned off, and an additional nginx directive is set:
Code:
location /api/ {
proxy_pass http://127.0.0.1:5000;
}
The log (Websites & domains > Logs) shows
Code:
502 GET /api/login HTTP/1.1
261955#0: *1686 upstream prematurely closed connection while reading response header from upstream
Any help in resolving the issue is greatly appreciated.
Further info:
The project is a MERN stack app, consisting of frontend and backend. Both parts are in separate folders under the same vhost-name. The frontend is reachable without any problem. The backend is a node-server (up and running). I tested to open the port 5000 directly and was able to work with it with a post to example.com:5000/api/login. I chose to setup node directly in the backend (and not via the Plesk interface), as I wanted to keep the separation between front- and backend.
Last edited: