How to fix 502 bad gateway error?

Now almost every inhabitant of the country has the Internet, with the exception of the elderly, so we use surfing every day. But sometimes, when going to certain sites or nodes, a 502 bad gateway nginx message may appear. In addition, the required resource is not loaded and the user cannot view the required information.

In most cases, this error occurs due to problems with the server. In this case, hosting may be unavailable, proxy server, DNS and other problems may be unavailable. Otherwise, the 502 bad gateway error is called the wrong gateway. This means that the user is currently unable to download information from the requested site when using the browser.

How to fix this problem

The first thing to check is your internet connection. To do this is quite simple. You just need to follow the link of another site. If in this case the data does not load, then there is a problem with the Internet connection. If the data loading has occurred, but the previously requested page still does not open, then it will be necessary to clear the cookies for the loaded site. This can be done in several ways:

  • For the Internet Explorer browser, in the menu you need to find the service button, then go to the Internet options, open the "delete" tab and click on the "delete cookies" button
  • For the Firefox browser, open the "Tools" menu, go to the settings and click on "clear cookies"
  • Similar steps are performed for Chrome and Opera browsers


By following the above steps, you can fix the error loading the site. If these steps did not help you, then this means that the problem is related to hosting or server problems. In this case, all your actions will be useless.

What to do if 502 bad gateway appears on your own website

When loading your own site, you suddenly come across this inscription, which should never be there. This means that the problem is not related to the Internet connection. There may be a server issue or hosting issue. Also, the problem of incorrect hardware settings is not ruled out, due to which the site code cannot be read.

With high attendance, there may be a lack of server power or RAM. In this case, you will have to find a more powerful platform to continue exploiting your resource. Otherwise, this error cannot be corrected.


Do not exclude the overload of the server, which occurs when numerous requests from a small number of visitors. In such a situation, you will have to optimize the site for a larger number of queries. If the server is working perfectly, then the problem lies in the site itself and you will have to carefully check the written code. There could be a hacker attack on the site and malicious code could be written into the code, which is why the resource does not load.