502 Bad Gateway nginx/1.18.0 (Ubuntu)

I have deployed the MERN stack project successfully . But now i am getting 502 Bad Gateway nginx/1.18.0 (Ubuntu). however the server is not running properly i am not able to fetch the backend data .please resolve this problem so that i will get out from this error.


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello @dailychoices2020,

Thanks for reaching out. A 502 Bad Gateway Error is a general indicator that there’s something wrong with a website’s server communication. Since it’s just a generic error, it doesn’t actually tell you the website’s exact issue. I recommend you to first check the Nginx error logs for more information.


You can also refer to our Community answer here for more details

Hope this helps!

Cheers, Lalitha

If you are still getting an error after following all the steps at the link in @Lalitha’s answer, check pm2 is running pm2 list If not, check you’re in the correct directory then pm2 start ./(your-server.js) This is assuming you have installed pm2

i have done this test with this command as well /var/log/nginx/error.log. However i found that there are some controllers in my web Application and routes it’s showing the same way as i have coded but i am getting confused how to fix it