Report this

What is the reason for this report?

502 Bad Gateway nginx/1.18.0 (Ubuntu)

Posted on January 28, 2021

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.

Thanks



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!

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.

Hi @dailychoices2020,

In order to fix the issue, I’ll recommend you checking the Nginx error_log. This error_log will provide you with the exact reason behind the 502 Bad Gateway error you received on Nginx.

If unsure, you should be able to find where your error_log file is located from your /etc/nginx folder in the configuration file of your domain.

If you find the error, post it here so that we can give some suggestions on how to proceed.

Regards, KFSys

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.

/var/log/nginx/error.log

You can also refer to our Community answer here for more details https://www.digitalocean.com/community/questions/502-bad-gateway-nginx-2?answer=62972

Hope this helps!

Cheers, Lalitha

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.