504 Gateway Timeout. Error means gateway timeout has elapsed. The user can see this error code if the server, acting as a proxy server or gateway, contacted the server higher in the hierarchy with a request, but did not receive a response in time. Servers with Apache installed as the backend and nginx as the frontend most often generate this error code. The user interacts with the server according to the following plan: the client sends a request to the server, which does not go directly to Apache, but is forwarded through nginx (this is something like a request distributor). If the latter was unable to receive a response from Apache, within a specified period of time, it sends the client a server error 504 (Gateway Timeout) instead of the desired result. How do I fix the problem? - Carry out server optimization. - Optimize scripts. - Increase the resources available for the server (the number of httpd (Apache) processes, RAM, etc.) - If the resource is located on shared hosting, you should think about changing the tariff plan or purchasing a virtual dedicated server. On simple shared hosting, only the administrators of the hosting provider can improve the situation. Because this may be due to their actions or the actions of the hosting provider's management as a result of too much placement of accounts on one server. In case of their inactivity, the best option would be to completely change the hosting provider. - Check for operability of the resources to which the scripts access. Very often they are the problem. - Check for what period of time the scripts are executed and whether they fit into the allotted limit. If necessary, increase the php_max_execution_time value in the php.ini configuration file. This parameter determines the execution time of the script, usually it is 30 seconds, if necessary, you can set 60. - If you cannot solve the problem using the above methods, you can try to contact the hosting provider's support service, if they cannot help, most likely you should think about changing the hosting provider.