In our job as system administrators and DevOps engineers, we help our customers with different types of errors on their websites. In this article, we will discuss "504 gateway timeout". This error is an HTTP status code, which means that one server did not receive a timely response from another server that it accessed, trying to load a web page or execute a browser request.

Reasons of getting 504 gateway timeout

Servers that have Apache installed as a backend and Nginx as a frontend often generate this error code. The user works with the server according to the following plan: the client sends a request to the server, which is not sent directly to Apache but is sent through Nginx (this is a kind of 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 message 504 Gateway Timeout instead of the required result.
This usually happens, when the web server is down for some reason. Meanwhile, there may be the following reasons of 504 gateway timeout:

  1. Browser errors - occur when a browser has some errors in configurations or settings.
  2. DNS errors - inaccurate DNS configuration of the domain may cause errors while accessing it.
  3. Network issue - the bad network connection between proxy and web server may cause delayed response and as a result - "504 gateway timeout".
  4. Slow web server - poor performance of backend web server may cause gateway timeout.
  5. Firewall misconfiguration - inaccurate firewall rules may be the reason of 504 error.
If you are worried about the stability of your online business - hire DevOps engineers to fix all the errors and make your server fast as a rocket.

How to fix 504 gateway timeout error

Before digging into a problem deeper you need to determine whether the reason is on a client-side or server:

  1. Open the website in another browser (Chrome, Firefox, Safari, Opera, etc.)
  2. Refresh the website.
  3. Double-check the firewall and ISP.
  4. Open the website from another location.
  5. Double-check browser settings.
  6. Double-check your connection.

After you confirmed that the issue is on the server side - the first thing you should do is check web server logs. Our approach and checklist to fix "504 gateway timeout":

  1. Check DNS settings and fix them if something is configured inaccurately.
  2. Check the network connection and try to resolve them (even contacting hosting support may be helpful).
  3. Ensure firewall rules are configured properly.
  4. Ensure that the website is not under high traffic or hacker's attack.
  5. Сheck the web server performance and optimize it if needed.
  6. Increase 'timeout' configuration setting in proxy and web server to an adequate one.
ITsyndicate helps clients to achieve maximum security and availability of their online business. We will not only help you to solve all errors - we'll help you to prevent them! Our experts can help. Contact us today or ask your question in the comments section.
Request more information today

Discover how our services can benefit your business. Leave your contact information and our team will reach out to provide you with detailed information tailored to your specific needs. Take the next step towards achieving your business goals.

Contact form:
Our latest news