Fix: Nginx returns 502 Bad Gateway with Node apps
Symptom
Nginx returns a 502 Bad Gateway error when accessing the site.
Cause
The upstream Node.js process is not running or incorrectly configured.
Solution
- Verify the Node.js application is running.
- Check the proxy_pass configuration.
- Restart Nginx and the Node application.
Verify
Check Nginx error logs.
Expected result:
Requests are correctly forwarded to the Node application.
Notes
Ensure the upstream port matches the application configuration.
This fix is part of Fix Pack – Ghost behind Nginx.
Get all fixes in one place:
https://diorama0.gumroad.com/l/ptrzok