Drupal and 504 Gateway Timeout (time out) nginx


Web developers often observe this kind of mistake on the servers with nginx as the frontend and Apache as the backend. The problem is usually assigned to nginx and  the latter gets strenuously cured. Quite often it’s not the point, anyway.

It should be admitted that 504 Gateway Timeout happens when nginx sends client Apache requests but Apache fails to return HTTP-response within the established limit of time.

So the essence of this problem is that Apache failed to respond. It’s possible that the site workload has increased and Apache gets short of time to give HTTP-responses while the new requests keep gathering in line. Clients are stuck in the line. If they are not served in the established time, connection fails.

In order to solve the given problem, one should first of all try to add resources to server, for example, RAM and to increase the number of http processes in Apache.

It’s also worth trying, though it’s not that easy, to identify the pages and the modules that might have caused the overload and to optimize them so that they would work faster. It takes more time and a good deal of qualification to accomplish that job, though.

The hosting must be analyzed, too. In case we deal with an ordinary virtual hosting, it's hardly possible to solve this problem without drupal having been tuned. Because as a rule there is no access to the hosting itself, you have what was given. Probably, the hosting will have to be changed. In any case you can always rely on our Drupal website hosting.

It might lso help if the time limit established for the script execution be increased, namely, the value of the PHP parameter max_execution_time.

5 votes, Rating: 5

Read also


Facebook Developer Blog published good news: from now on one can get user’s address and cell phone number.

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join the people who have already subscribed!

Want to be aware of important and interesting things happening? We will inform you about new blog posts on Drupal development, design, QA testing and more, as well news about Drupal events.

No charge. Unsubscribe anytime