If the server on which your resource is located,overloaded (this is due to the exhaustion of the traffic limit), it gives the user a message: "Error 504 gateway time out." In translation into Russian this means: "the gateway response time has passed, the gateway does not respond." A situation arises when Apache can not physically handle all http requests, and they queue up. However, there is a time limit, and a message comes that the request has not been processed.
To correct the situation, it is necessaryoptimize your server. To do this, you need to change the amount of RAM and the number of http requests (Apache) in the direction of increasing them. Another option is to optimize the performance of all the scripts that are on your site. This operation will help improve the processing performance.
If you pay for your hosting, you shouldimmediately seek help from the support team. The support service is required to check your site for any malfunctions and, if possible, "repair" it. Do not neglect such an opportunity. "Hole", which must be patched, may be more than you think. Some hosting providers provide technical support over the phone. This type of help is very useful if you are faced with such technical problems as error 504 for the first time. Thanks to this support you can learn how to eliminate them yourself, without help.
There is one more reason whythere is a 504 error: a script that executes a command does not fit into the time frames that are specified for it. This may be due to the request of third-party resources, or he himself is currently engaged in another matter. For example, it builds a search index.
To remove a malfunction, you can go in two ways:
1) facilitate the script by optimizing it;
2) increase the value of the PHP parameter max_execution_time.
Once again I would like to raise the issue oftechnical support of the hosting provider on which your site is located. Of course, everyone has his own, but the responsibilities of support for everyone are mandatory. There are cases when questions sent to the support team are ignored. Especially if it concerns any lags. For example, you get the same error 504. In this case, change the hosting. If more serious problems begin, then you can hardly expect to help them.
There is one more point about whichmention. If your site is located on a free hosting and has a three-level domain, do not expect that your applications will be considered in the near future. First of all, these support servers work with clients who pay for them a month on virtual disks. Of course, there is no reason to condemn them, because regular customers are more important. Therefore, if you want to prevent 504 from bothering you in the future, go directly to paid hosting. There's no catch in this, by switching to such a package, you will save yourself and your work on the Internet from a host of undesirable and unpredictable problems.
That's all I wanted to tell you about this phenomenon, like error 504. Let it occur to you as rarely as possible!