504 Gateway Time-out: what is this error and how to get rid of it?

Error 504 Gateway Time-out when trying to access a specific Internet resource is considered one of the most common. In this case, however, practically nothing depends on the user from whose computer the request for the page is made (it is possible that the browser version may need to be updated or even switch to using another browser). But the owners of servers and sites located on certain hosting companies may encounter the problem of its occurrence quite often. Next, let's try to briefly consider why such a failure occurs. and give some practical advice on how to fix a recurring error.

Error 504 Gateway Time-out: Translation and General Understanding

In order to fully understand what is actually being discussed, first you need to clearly understand the nature of this failure. If you offer readers a simple interpretation of the 504 Gateway Time-out error, a translation might mean something like the expiration of a timeout for passing through the gateway. But this applies only to those cases when, when accessing the requested page, the wait time for the response of the resource is exceeded. That is, the request from the remote computer to the resource passes without problems, but the server does not have time to process the request and send a return htttp response in the allotted time.

This can be explained by a simple example, when the Apache server is installed as the backend, and nginx plays the role of the frontend. 504 Gateway Time-out when responding in such a pair appears most often. The circuit works in approximately the following way.





The simplest principle of the Apache + nginx pair




A client request to the server is not sent directly to Apache, but first passes through nginx (something like a distributor). If the Apache server is not able to process the request and send the response within the allotted time, nginx generates this error if there is no response. In general, it is worth saying that almost all versions of the Apache server have one rather unpleasant feature, consisting in the fact that they actually do not have a sufficiently high speed of processing requests. In addition, their work can also be affected by a huge number of currently active third-party processes and executable scripts, the operation of which may also fail.

Error 504 Gateway Time-out: Hardware-based troubleshooting on servers

Now let's move from theory to practice and try, as far as possible, to try to eliminate this unpleasant glitch.

Server too slow




Typically, experts in server owners in the simplest situation recommend using the simplest method of eliminating the 504 Gateway Time-out error, which implies increasing the power of the equipment in order to increase the performance of computers. You can try to increase the amount of RAM on the server, install newer processors, etc.

















Error correction by the simplest software method on sites

As for the pages themselves and the hosting sites on which they can be hosted, using the Apache + nginx bundle, as a first resort, you can try to increase the number of httpd processes directly on the Apache server. In addition, you can apply a more reasonable solution. As mentioned above, the server does not have enough time to process the request, and the dispenser sends a 504 Gateway Time-out error instead of a response. The PHP parameter max_execution_time needs to be changed by setting a larger value for the time period (for example, in the region of 500-700 sec.).

Timeout parameter




In addition, it is highly recommended that you check all active third-party processes and disable those that are simply not needed. Particular attention should be paid to SQL queries and executable scripts.

Script execution issues

But with scripts this is not so simple.

Database Import Error




Errors due to their fault usually occur due to the fact that the scripts themselves can access data on the site or external databases that are not available at a certain point in time, and, again, do not have time to get an answer. Often, a 504 Gateway Time-out failure may also result in an attempt to connect to a proxy server that cannot process an incoming request and send a response. Finally, do not forget that often enough access to data can be blocked by third-party processes (for example, weather applets or widgets for current exchange rates, etc.). Accordingly, it is necessary to optimize their implementation.

Error using Joomla control system

Finally, the 504 Gateway Time-out error of 504 in Joomla most often appears corny due to the fact that the control system itself is constantly updated, which is far from the best way affects its functioning. For example, many experts note that the “boxed” modification of Joomla 3 must be optimized by installing additional modules and plugins. But an update of the system itself to version 3.6.5 can provoke conflicts with the codes of installed obsolete add-ons, which leads to a slowdown of the server and the appearance of the described failure. Accordingly, all add-ons also need to be updated (although keeping track of the automatic continuous updating of the Joomla system itself can be very problematic).

Alternatively, you can make a copy of the entire site for yourself by creating a new directory in the root and placing copies of all the files there. Then create a copy of the database and write its configuration (Configuration.php).

Add-on Management in Joomla 3




Now go to the administrative section of Joomla, after which in the plug-ins section sequentially disable add-ons, starting with those that were installed last. It is possible that one of these plugins causes this problem to occur. For example, some note that very often an error pops up due to the fault of the JSitemap Pingomatic add-on.

Additional advice to site owners

If you are just the owner of the site and host it on a specific hosting, but none of the above solves the problem, it may well be time to think carefully about changing the hosting provider, which is not able to provide you with normal technical support.




All Articles