502 Bad Gateway nginx/1.18.0 (Ubuntu)

Posted January 28, 2021 2.2k views

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.


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.

Submit an Answer
3 answers

Hi @dailychoices2020,

In order to fix the issue, I’ll recommend you checking the Nginx errorlog. This errorlog 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.


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!


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