

As has already been mentioned, this results in the affected system to not receive a response from the next link in the chain. HTTP 504 messages always occur when an intermediary server, or rather a network interface, cannot respond to the browser’s query within a clearly specified time. Examples of frequently used 504 error messages are:

Exactly how the error message is displayed in the browser window is something which the website operator can decide for themselves.

The sender of the message is the server in the communication chain that was unable to fulfil its function as a gateway, or proxy, as it didn’t receive a response from the next server (or service) within a specific time.
#504 gateway time out nginx wordpress code
This is why the message code also displays the designation ‘Gateway Timeout’. The HTTP 504 response lets the client know that the cause of the failure was due to a timeout during the processing of a request. The server then responds to this with an answer that includes a 504 status code, which for example might include information on a successful processing (HTTP 200), or else information on its failure, in the case of a 504 error. This exchange occurs via notifications through which the client defines a HTTP request.
#504 gateway time out nginx wordpress software
For this reason, HTTP communicates the website’s hypertext, which the client software can in turn convert into text, images, etc. Operating on the application layer, it initiates communication between the client – normally an internet browser – and the corresponding web server hosting the desired content. We still had a problem with the one site which continued to throw 502 and 504 errors but this was due to a combination of a poorly built plugin and the user using that plugin incorrectly and generating the insane number of admin-ajax POST calls.The Hypertext Transfer Protocol is one of the most important protocols when it comes to the transfer of web content. NOTE we only made the change for this particular site, we left the rest of the sites as Nginx proxy+Apache. This essentially eliminated the root cause of the problem because Nginx processed all requests and didn’t connect to Apache. The solution in our case was to switch the one problematic site to use Nginx only without the Nginx+Apache configuration. Once the Apache connection limit was reached Nginx started showing a 504 gateway error for all sites because Apache was no longer responding to it. It turns out this particular site was receiving hundreds of admin-ajax POST requests per minute tying up PHP and hitting the connection limit between Nginx and Apache. Root Cause – Apache connection limit reached On Plesk, changing to a dedicated PHP-FPM pool instead of shared pool maybe help – it wasn’t the fix in this case but it might be in yours. NOTE: There are certainly cases where increasing the PHP max_children setting max fix this 504 error problem. Initially we had thought the issue was in PHP with PHP workers being busy or some other issue with max children settings or similar.Īfter hours of troubleshooting and messing with dedicated and shared PHP pools, changing from PHPFPM to FastCGI and changing PHP versions the issue was still present so it appeared PHP was not the root cause. This was a Plesk server but the same issue could happen on any server using Nginx with Apache, e.g. We came across an issue recently on a server where all sites were throwing a 504 gateway error when a single WordPress site was under high PHP load.
