How do I troubleshoot a 502 error with nginx / node?

I have an ubuntu server that I use for development. It was working perfectly fine until I got an email from DO saying “We’ve had to reboot your Droplet as a result of an issue with the physical node that hosts your Droplet.” and then that they were performing an emergency droplet migration.

Since then I can’t access my site. Before it would start up when rebooting just fine, but now I get a 502 every time. MongoDB should start on startup, and node gets run with PM2. I can see the output from node and it starts just fine like it normally would, but when making a request, it returns 502 and doesn’t seem to reach node at all.

I don’t know a lot about servers, and had to pay someone to setup nginx and the certificates for me, but none of that configuration should have changed since it was working. I in fact hadn’t even made any code changes since before the droplet failure.

Any advice would be appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Solved, an environment variable was overriding my port number, causing it to start on the wrong port.