502 bad gateway: what does the error mean and how to fix it


To download web resource data (text, video, images), it is necessary that the browser receives information about the physical location of their location. To do this, the browser requests the physical server that hosts the site files. If the browser does not receive a response to its request, an error with a number from 500 to 511 appears.

The cause of the 502 Bad Gateway error (which means a bad gateway) is the incorrect operation of the proxy server, DNS server, or server hosting the web resource.

Causes of the error

Most often, a 502 error occurs due to server overload, which occurs in the following cases:

  • high attendance of the server;
  • hacker attacks (DDoS attacks);
  • overselling (resale of server computing resources);
  • low-quality optimization (the site is configured for a small number of visitors).

The second reason for the appearance of gateway 502 is PHP errors. This happens when, while expanding the functionality of the site, the owner or webmaster adds plugins that have not been configured correctly or in the case of an incorrect site code.

The third reason may be a browser error, if you install its extensions that break the connection with the site. Since the user and the site owner have different access rights, each has a different set of actions to take when problems occur.

Might be interesting: how to improve laptop performance

Recommended actions for the user

If the user is unable to access a particular web resource, then he needs to:

  • reload the page, if the problem is due to an increase in the flow of visitors, then after a decrease in their number, the site will become available;
  • try to go to another site, if other resources open, then the problem is on the site, you can return to it later, when technical support will deal with the problems;
  • check the Internet speed and its availability, for this reason, a 502 bad gateway error may also appear;
  • run the browser in Incognito mode, when it works with basic settings, if you can go to the site, then some extension is preventing the connection, which should be disabled;
  • clear cookies and cache, because sometimes after access is restored, the browser tries to connect to the cached version;
  • clear the DNS cache, which is a temporary database that stores the IP addresses of all recently visited websites, if the browser accesses the old IP address, a virtual 502 error occurs.
Do not miss:  Resident Evil 3 Remake Gets First Trailer And Release Date

Using these methods will help get rid of the 502 error if the user's computer is the problem. In all other cases, the user can only contact the administration of the resource or wait for the problem to be fixed.

Site owner actions

It is difficult for a user who does not get to the site of interest to him, but for the site owner, the appearance of a 502 error is a signal of possible losses. What should the owner of the web resource do in this case:

  • check the amount of free memory;
  • check server logs;
  • check plugins.

It is worth considering in more detail that this is a 502 error.

Memory check

Memory is checked in 2 ways.

  1. In the first method, you need to enter "top" on the command line. Information will be displayed on the screen, where Mem - free will mean the amount of free space on the server. With a small value of this number, it must be increased.
  2. The second method introduces the free-m command. further actions repeat the first paragraph.

Increasing the memory can give a result, then no further action is required.

Checking logs

After checking the log, the cause of the failure is visible, if it is caused by an update or change, as well as DDoS attacks. The inscription “out of memory” displayed on the screen will report the lack of memory. If it's about updates, they need to be canceled. Reverting the system to its previous state will help get rid of the error. If this does not help, then you need to check the plugins.

Check plugin

Installing additional plugins may disrupt the normal operation of the resource. To check them you need:

  1. go to the list of installed plugins;
  2. disable one or all installed plugins;
  3. further disable or enable plugins one by one to find out which one complicates the work;
  4. remove the found plugin.

Error 502 this may be the result of incorrect operation of auxiliary programs such as MySQL or Memcached. They also need to be checked for compatibility with the resource.

Do not miss:  Best Windows Programs: Which Option to Choose

Contacting Technical Support

If all of the above actions did not work, then the code 502 server error. In this case, attempts to fix the error yourself will not work. The best way out is to contact the technical support service, with a detailed description of the problem and the actions taken.

You may also like

Please rate the article
Translate »