How is bad gateway translated? Error "502 Bad Gateway" - what is it? Causes of occurrence and solutions. Change default proxy server

Sometimes, when traveling through the Internet and visiting a particular site, you may see something wrong there. necessary information, A white background and there is an error on it in large letters: 502 Bad Gateway. What does it mean? Nothing good, really. This message is issued by the nginx web server when some problems occur. If you try to open other pages on the same site using saved links, it will also not be successful. What to do? And this depends on who you are for this site.

If you are a simple visitor, then there is only one solution - wait until the administration of the web resource fixes the service. How long? It's hard to say. If this is a large portal of a company, firm or government agency, then the administrator must restore the site to operation in the near future. If this is the personal blog of some Vasya Pupkin, then it is quite likely that no one will fix anything, since Vasya forgot about his blog and does not need it.
A) If you really need the information on the page, then either try to find the administration’s contacts and contact it by mail or through a registrar or hoster, or use the search engine’s web cache by entering a link to the site or page in the search bar of the search engine and opening the saved copy.
b) Very often, Nginx error 502 means that the web resource of interest is overloaded. What to do? Again, just wait until the load decreases, periodically refreshing the page in the browser.
V) If after some time the site opens on other computers and other devices (tablet, phone, laptop) without problems, but yours still displays an nginx error, then you need to clear the browser cache.

If you are the owner or administrator of the site, which, when you try to access it, gives you the error 502 Bad Gateway, then you will most likely have to solve the problem. It all depends on whether you have SSH access to your hosting or not. If not, then the problem automatically falls on the shoulders of your hosting provider - contact technical support With detailed description problems. As a rule, in this case everything is resolved quite quickly, since there is usually more than one site on the server and requests also come from other clients.
It’s worse if your site is located on a virtual (VPS) or dedicated (VDS) server. In this case, usually, it won’t be possible to shift the problem from a sore head to a healthy one (read: from your own to the hoster’s technical support) and you will have to fix everything yourself. What to do?
First, try restarting the nginx server. On CentOS, for example, this is done with the command:

Service nginx restart

If you use it as a front-end for the Apache server (httpd), then the latter could crash or hang - restart it too:

Service httpd restart

It didn’t help - look at the current server load using the command:

Pay special attention to the parameter value load average:

It should be approximately equal to the number of processor cores, well, plus/minus 2. If the load average value is more than 10, then you should sound the alarm - something is heavily loading the server’s processor. Often behind this there is a directed DDOS attack. Find out the reason - most likely eliminating it will return your site to normal life.

  • Video adapter: error code 43 - how to fix...
  • Error. Please try again later. Identifier…

Surely, every Internet user has at least once encountered the “502: Bad Gateway” information message. A message like this indicates an error occurred on the web server side while processing the request. Typically, the problem is a DNS or proxy server mishandling.


Error “502: Bad Gateway”: what does it mean?

The appearance of such an error indicates that the web server received a request from the browser, but it was removed from the general queue or simply processed incorrectly. If at the software level the server is located behind an Internet gateway, then it is quite possible that the problem lies precisely in the gateway or in the operation of the web server, which transmits an error message to the gateway. After this, the information appears in the user's browser.

What could be the reason for a 502 problem?

1. Lack of server resources

The main reason for this error is the insufficient level of service resources required to process requests. Because of this, the server may begin to generate a 502 error. Lack of resources can be either software or hardware. Software shortage of resources is associated with the features of the software used or incorrect server configuration. Hardware starvation is usually caused by insufficient processor speed or lack of RAM.

Situations are also possible when, despite a sufficient level of resources, the server continues to display an error message 502: Bad Gateway. Most likely the reason lies in hardware failures. Also, resource limitation can be performed automatically if the virtual hosting goes beyond the limits tariff plan. The server cannot cope with the current load. Web servers such as Apache typically have a strictly defined number of request handlers. This quantity is set during configuration. If all handlers are busy at the same time, then each request is automatically moved to a queue. For each of them, the waiting time cannot exceed 1 minute.

If the waiting time is exceeded, processing of the request will be cancelled. The user will receive a message that error 502 has occurred. In addition, the handler may simply not have enough resources to fully process the queue. When using the PHP + FastCGI combination on the server, quite often problems arise related to a lack of resources, or overloads due to an unoptimized number of php-cgi processes.

Reasons for lack of resources when processing requests

The server may simply not be able to handle the large number of site visitors. A significant portion of resources can also be wasted by incorrectly composed software scripts and search robots. Server overload may be due to a hacker attack. With this impact, the server simultaneously receives a huge number of requests to process. Sometimes situations arise in which a 502 error appears when using shared hosting. Such cases indicate a problem on the hosting side. This is the so-called overselling, or in other words, the hosting of a large number of user accounts on one server. As a result, at the time of peak load, the server does not have enough hardware resources.

Error 502: Bad gateway can occur due to incorrect server configuration and lack of hardware or software compatibility. When using additional external resources on the site, for example, informers, message counters or scripts, problems may also occur. this problem. Another reason for the error “502: Bad Gateway” may be loading large files to the server at low connection speed.

PHP script error

A possible reason for the appearance of “502: Bad gateway” may also be the use of various plugins, scripts and extensions in PHP. Perhaps they do not transfer the corresponding code to the server after completion of execution. If all static information from sites loads normally, then most likely the “502: Bad Gateway” error means a failure when loading software scripts, extensions and plugins.

What to do if a “502: Bad Gateway” error occurs

First of all, it is necessary to analyze the current server load. Please pay attention special attention loading of RAM, if necessary, you can try to increase its size. Also check that the limits on the number of concurrent php-cgi processes are configured correctly. If the configuration is incorrect, overload can occur quite quickly. All information about correct setting Process limits can be obtained from your hosting provider's support service.

While you are browsing any websites or pages on the Internet, you may see a 502 error message on your monitor screen when accessing various sites. However, you cannot open site pages, and you do not have the opportunity to view and explore the resources of this website. As a rule, such an error occurs due to the fact that problems are detected in the operation of servers, mainly a proxy or hosting server, on which at the moment there is an inaccessible site.

The expression “error 502 bad gateway” can be translated as “invalid gateway”. This will mean that the browser (Internet browser) on your computer, when requesting some information from the website, received an unacceptable response from another server (DNS or proxy server). This is what the user is informed about when the “502 error” message is displayed on the screen.

Most Internet users have encountered this error many times, but for some this may be the first time. What to do when an “error 502” message appears on your computer screen? First of all, you need to check whether there is access to the Internet at all. To do this, you should type in your browser the address of another site, which is guaranteed to be working at the moment, since, for example, corporate access to the Internet is carried out through a proxy server, and not immediately through a modem connected to or built into your computer. If in the latter case the error is recognized in more detail, then when accessing the Internet via local network the system has no way to check the error. In this regard, the user has no choice but to find out the reasons for its occurrence by indirect methods.

If you have access to the Internet, but when you try to request a page from the required site again, the message “error 502” still pops up, then in this case you should try to delete cookies for this site or all those in your browser.

To do this you can do the following:

  • for Internet Explorer versions 7+: in the menu, go to “Tools”, then select “Internet Options”, click on the “Delete” button, and then click on the “Delete cookies” button;
  • for more earlier versions Internet Explorer: go to the “Tools menu”, look for “Internet option” and click “Delete cookies”;
  • for Firefox: go to “Tools”, look for “Settings”, select “Cookies” and click on “Clear cookies”;
  • for Opera: go to “Tools”, select “Delete personal data” and check the required options;
  • For Google Chrome: go to “Tools”, click “History”, click on “Clear history”, and then on “Clear cookies”.

During normal, normal operation, such an error appears very rarely, only when the web servers are rebooted. If it persists for more than thirty seconds, then you should try the browser, cookies, and restart the browser itself

If, after clearing cookies, the message “error 502” still appears on the screen, this indicates that everything is fine with your computer and network, and, most likely, there is simply a problem with the server. In this case, you should wait a bit until the administrators resolve these issues and then try again.

Good afternoon

In 99% of cases, the 502 Bad Gateway error indicates that there are problems on the server side that serves the website.

502 Bad Gateway- http protocol error, which is returned by the server serving the site (frontend) when it is impossible to receive content from auxiliary servers (backend).

  • The printer does not print from the computer and queues - how to fix it?
  • What should a user do if a 502 Bad Gateway error occurs:

    1. If possible, inform the site administration about the error that has occurred. This can be done via Twitter, social media or by email.
    2. Please check back later. All normal Internet projects have administrators on duty who must track this error and return the site to a working state as quickly as possible.
    3. If the site has been down for a long time, try finding the information you need on another site.

    What should a site administrator do in case of a 502 Bad Gateway error:

    Almost always the 502 Bad Gateway error is given to the nginx user. This means that you are using nginx as the frontend server and php-fpm or apache as the backend server. Your backend server has failed and needs to be restored to functionality. Recommended sequence of actions for speedy recovery services:

    1. Restart your Apache or php-fpm server (restart the service). The service could freeze, for example, due to a heavy load.
    2. Check the functionality of support services such as MySQL and Memcached. Rarely, they can also cause a 502 Bad Gateway error.
    3. If one of the services does not start, check the free space on the server disk with the command df -h, if the space runs out, urgently free it and restart the services.
    4. Check the load on the server using the top command; if it is very high (la indicator is more than 10), reboot the server completely using the reboot command.

    When browsing the web and repeatedly accessing any links, the message “Error 502 Bad Gateway” may be displayed on the screen instead of the site, and it becomes impossible to view information posted on the site. The appearance of such a message most often means that problems have arisen on the proxy server, DNS server, or hosting server that hosts the site requested by the user.
    In fact, the display of this message means that the browser received an invalid type of response from the server, and the general screen saver “Bad Gateway - Error 502” appears on the computer display as information about the situation that has arisen. Apache Server may not have had time to process the request or may have simply done it incorrectly. If the server is running behind a gateway, the root of the problem may lie in it, or in Apache Server, which sends a message to the gateway about the problem.

    What could be causing the 502 error?

    The main problem leading to the error is the lack of resources on the server computer, which leads to the appearance of the “502 Bad Gateway error” message. Most often this happens due to insufficient RAM on the computer. You can determine this by looking at the load level and consumed resources in the manager. If the hosting tariff is exceeded, a restriction may be triggered and an error may appear. This can be corrected by switching to a tariff with a larger amount of computing power.
    Apache Server is characterized by a rigid number of handlers fixed by the server configuration. If all handlers are busy, the request will go into the processing queue and wait in it for no longer than 1 minute, and after the time has expired, “Error 502” will appear. In addition, handlers may not have enough resources to process requests properly.

    What should a user do when an error 502 appears?

    First of all, you need to type in your browser a link to another guaranteed working resource, and thus check for Internet access. If you have access and the error reoccurs when accessing a specific resource, you need to clear your cookies in your browser settings. If this manipulation did not help correct the situation, then most likely the problem is on the server hosting the site.

    How can a webmaster fix “Error 502”

    1. Analyze the level of current load on the server and the load at the time the error occurred. If there is a heavy load on the RAM, it is necessary to increase its volume.
    2. In case of constant occurrence of code 502, you need to check whether the limit on the number of php-cgi processes is configured correctly, because their incorrect configuration will lead to permanent failure of the server.
    3. Minimize the number of calls to external resources and set a limit on response time. These steps will help you monitor “slips” during downloads and identify server problems.
    4. For sites located on virtual hosting, the cause of the error may be poor server configuration settings. In this case, it is recommended to change your hosting service provider.


    2024 wisemotors.ru. How does this work. Iron. Mining. Cryptocurrency.