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

  1. Verify the Node.js application is running.
  2. Check the proxy_pass configuration.
  3. 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