The 504 Gateway Timeout error is 1 of the most mutual HTTP 5xx errors faced by website owners and site visitors. For many WordPress blogs and ecommerce platforms, knowing how to ready server errors like this is crucial to keep their hard-earned visitors from billowy to competitor sites.

As the 504 Gateway Timeout error doesn't tell you why information technology occurred, it's hard to pinpoint what'due south causing the server timeout. This article will aid yous understand it in detail, acquire how to diagnose its cause, and then fix it.

After trying all the various solutions mentioned in the postal service, your site should exist up and running in no time.

Sounds interesting? Let'due south dive in!

Prefer to lookout the video version?

The 504 Gateway Timeout error is one of the near common HTTP 5xx errors faced past website owners and site visitors. 🤔 Learn how to fix it with this guide quickly. ⬇️ Click to Tweet

What Is the 504 Gateway Timeout Error?

Every time y'all visit a website in your browser, the browser sends a request to the spider web server where the site is hosted. The server processes the request and responds with the requested resource.

Illustration of how HTTP requests and responses work
How HTTP requests and responses work.

The server response includes one of many HTTP status codes to indicate the response's condition to the browser. But not all these HTTP condition codes are errors. For instance, a 200 OK status code means that the server processed the request successfully and "Everything is OK."

The 5xx form of HTTP status codes indicates that something's wrong with the server, the server is enlightened of information technology, and information technology cannot carry out the client request. As a upshot, they're likewise referred to as Server Error 5xx status codes.

Officially, 5 status codes are specified under the 5xx class (500, 501, 502, 503, 504). You may come upon many unofficial codes too (506, 507, 509, 520, etc.).

The Internet Engineering Task Strength (IETF) defines the 504 Gateway Timeout error as:

The 504 (Gateway Timeout) status lawmaking indicates that the server, while interim as a gateway or proxy, did not receive a timely response from an upstream server information technology needed to access in gild to complete the request.

To simplify information technology further, this error occurs when ii servers are involved in processing a asking. The starting time server (typically the primary server) times out, waiting for a response from the second server (upstream server).

The 504 Gateway Timeout mistake manifests itself in diverse forms. Here are some ways information technology usually shows upward:

The HTTP ERROR 504 in Chrome browser
The 'HTTP ERROR 504' in the Chrome browser.

The 504 Gateway Timeout error is similar to the 502 Bad Gateway error, which indicates that the starting time server received an invalid response from the second server (upstream server).

504 GATEWAY TIMEOUT status code in Chrome DevTools
The '504 GATEWAY TIMEOUT' status code in Chrome DevTools.

Variations of the 504 Gateway Timeout Fault

The browser displays whatever 504 Gateway Timeout error inside it, just like any other error. Every bit there are various operating systems, web servers, browsers, and user agents, it can show up in multiple ways.

Beneath are a few common 504 error message variations that you may run into:

  • 504 Gateway Timeout
  • 504 Gateway Timeout NGINX
  • NGINX 504 Gateway Timeout
  • Gateway Timeout Mistake
  • Error 504
  • HTTP Error 504
  • HTTP Mistake 504 — Gateway Timeout
  • HTTP 504
  • 504 Error
  • Gateway Timeout (504)
  • This folio isn't working — Domain took too long to respond
  • 504 Gateway Time-out — The server didn't respond in fourth dimension
  • The page request was canceled because it took besides long to consummate
  • Site visitors: There was an effect serving your asking, please try again in a few minutes.
  • Site Owners: There was a gateway timeout. Yous should visit your error log for more information.
  • A blank white screen

All the above error responses, though worded differently, point to the same 504 Gateway Timeout server error.

Spider web servers and websites tin customize how they show the 504 Gateway Timeout error to users. Some of them can be cool! It'southward an fantabulous tactic to quell their visitors' thwarting.

GitHub's customized HTTP 504 error page
GitHub's customized HTTP 504 error page.

SEO Touch on of the 504 Gateway Timeout Error

All 5xx errors prevent a webpage from loading, making them detrimental to user experience. Hence, search engines like Google take these errors seriously. If the fault persists for a long duration, it may even pb to deindexing the webpage from the search engine results.

For example, when Google spiders stumble upon a 503 Service Unavailable mistake, they'll empathize that it's a temporary outcome every bit information technology's by and large used to enable site maintenance mode. Thus, they'll try to crawl the page over again later.

A 504 Gateway Timeout fault isn't necessarily temporary as information technology can be due to multiple reasons. If your site is down for just a few minutes, and if the spiders are trying to crawl it multiple times every minute, they'll try to serve the page from their cache.  They wouldn't even discover it.

But if your site is down for 6+ hours or more, then Google will consider the 504 error as a serious site-wide upshot that yous need to gear up as soon every bit possible. This can impact your SEO negatively.

Viewing the crawl errors in Google Search Console
Viewing the crawl errors in Google Search Console

Google Search Panel is one of the all-time SEO tools to monitor your website's HTTP 5xx errors.

Causes of the 504 Gateway Timeout Mistake

Equally the 504 fault is due to a timeout between servers, the problem probably isn't with the customer's device or cyberspace connection. That also includes your device and connection.

A 504 Gateway Timeout error indicates that the spider web server is waiting too long to respond from another server and "timing out." There can be many reasons for this timeout: the other server is not functioning properly, overloaded, or downwards.

The other server demand not e'er exist external (eastward.g. CDN, API gateway). It can likewise be a server-like entity within the main web server (e.g. contrary proxy server, database server).

How to Gear up the 504 Gateway Timeout Error

Without knowing exact details about the WordPress site, such as its server configuration, hosting plan, tertiary-political party plugins, and the traffic it attracts, y'all may observe information technology frustrating and overwhelming to set up a 504 Gateway Timeout mistake.

Since many variables are involved, I recommend you to offset by fixing client-side bug, which are pretty rare, and so motion towards fixing server-side problems. They're normally the culprits with 504 errors.

Try Reloading the Webpage

Ane of the first things you tin effort when encountering a 504 Gateway Timeout mistake is to wait a few minutes and attempt reloading the page.

You can press the F5 keyboard shortcut to refresh/reload the webpage in well-nigh browsers. To remove the page's browser cache before reloading, you can printing the CTRL+F5 shortcut combo instead.

Refreshing a webpage in Chrome browser
Refreshing a webpage in Chrome browser

While you're at it, you can also attempt loading the site in a different browser to rule that out as an outcome. As most 504 errors are due to temporarily overloaded servers, using this solution should make your site come correct back.

If waiting and reloading the site doesn't fix the 504 fault issue, you can bank check whether a site is downwardly for everyone or but you. Two useful online tools to test a site for downtime are Down for Everyone or Simply Me and Is Information technology Down Right Now?

Testing Kinsta.com on Down for Everyone or Just Me
Testing Kinsta.com on Downwardly for Everyone or Just Me

Reboot Your Network Devices

Sometimes, problems with your network devices similar modem or router could lead to a 504 Gateway Timeout mistake. Rebooting these devices could help yous with fixing the problem.

While you lot can switch off all these networking devices in any order, the order you switch them back on is important. Typically, turn these devices on from the "outside-in," post-obit the connection order from the internet service provider to your main client device.

Bank check Your Proxy Settings

A proxy server sits between your device and the internet. It's by and large used to enhance online privacy by hiding private data (e.yard. device location) from websites and webservers (e.g. using a VPN).

While it's rare for proxy servers to crusade a 504 mistake, incorrect proxy server settings can sometimes be the reason. Y'all can disable the proxy server and try reloading the webpage to see whether it'll fix the error.

Changing the 'Proxy' settings in Windows 10
Changing the 'Proxy' settings in Windows 10

Well-nigh clients don't use a proxy service, so yous tin can skip this footstep if you're confident that you don't apply whatsoever proxy server. However, you might take set it without you lot even knowing about it. I'd suggest you check your device'due south and browser'due south proxy settings to rule this crusade out.

DNS Issues

A 504 Gateway Timeout error can also be caused by DNS bug on the server-side or the client-side (or both).

The most probable reason for a server-side DNS result is the FQDN (fully qualified domain name) not resolving the correct IP address or the DNS server not responding. Usually, this occurs when you've simply migrated your WordPress site to a new server or host. Hence, it's of import to wait for the domain'south DNS records to propagate fully, which can take upward to 24 hours.

You can employ gratis tools like whatsmydns.cyberspace DNS Checker or DNSMap to see if your DNS has propagated around the earth.

Checking DNS propagation for your domain on whatsmydns.net
Checking DNS propagation for your domain on whatsmydns.net

For fixing customer-side DNS problems, you could endeavour flushing your local DNS cache. It'southward like immigration your browser cache, except here, you're flushing the DNS enshroud from the operating system.

If you're using Windows, y'all can flush the DNS cache past opening the Command Prompt and entering the post-obit directive:

          ipconfig /flushdns        
Flushing the DNS Cache with Command Prompt
Flushing the DNS Enshroud with Command Prompt in Windows

You lot should run into a "Successfully flushed the DNS resolver Enshroud." message if it worked.

For the latest macOS versions, you can open the Terminal and run the following command:

          sudo killall -HUP mDNSResponder        

You lot won't run into whatever notification in macOS when the process finishes, but you can change that past appending the command with your custom bulletin.

          sudo killall -HUP mDNSResponder; DNS Enshroud was cleared successfully        

If you're using older macOS versions, the command you lot need to enter varies based on which version of macOS yous're running. For more details, you lot tin can refer to the macOS section in Kinsta's in-depth flush DNS tutorial.

If you're using the Linux operating system, then the procedure is quite like to macOS as fifty-fifty Linux uses the Terminal every bit its command-line interface. Since at that place are many Linux distributions, the exact control yous need to run may vary from one distro to another. You can check out Kinsta'south guide for more information.

Finally, you can change your client-side DNS servers temporarily. By default, your ISP assigns the DNS servers automatically to y'all. But y'all can change these to public DNS IPs temporarily.

Some reliable DNS servers yous can endeavor out are Google Public DNS, Cloudflare i.ane.1.i, Quad9 DNS, and Cisco OpenDNS.

Settings custom DNS servers in Windows 10
Settings custom DNS servers in Windows 10

Disable Your Site's CDN Temporarily

Sometimes, the issue could also be with your content delivery network (CDN). If a site's origin server isn't reachable, most CDNs will try to serve the total webpage from their enshroud.

But most CDNs don't enable this feature past default every bit it'southward complex to enshroud dynamic assets on most sites (e.grand. the WordPress admin dashboard).

Setting the 'Cache Everything' page rule in Cloudflare
Setting the 'Cache Everything' page dominion in Cloudflare

A straightforward mode to troubleshoot this is to disable your CDN temporarily. For example, if y'all're using the free CDN Enabler WordPress plugin to link your site assets to the CDN URLs, then yous tin can deactivate the plugin and test reloading your site.

The same goes for using any other plugin you may use to connect to your CDN (eastward.k. WP Rocket, Breeze, W3 Total Cache).

If y'all can't access your site's admin dashboard, you tin disable the plugin via SFTP past renaming the plugin's folder proper noun.

Disable all plugins via SFTP by renaming the plugins folder name
Disable all plugins via SFTP by renaming the plugins folder proper noun

CDNs similar Cloudflare or Sucuri, which provide full proxy services, have extra firewalls betwixt their edge servers and your origin server. Hence, you may see HTTP 5xx errors more oftentimes while using them. Nigh of them cache 5xx errors returned past your origin server, then it's easy to troubleshoot them.

Cloudflare'southward gratuitous plan is prone to throw up a 5xx error. Unfortunately, since it's a full proxy service, there's no quick manner to disable it. But before yous arraign Cloudflare for it, know that Cloudflare shows 2 variations of the 504 Gateway Timeout error.

504 Gateway Timeout at Cloudflare (Variation 1)

Cloudflare volition testify you a custom 504 Gateway Timeout fault screen when your site's origin server responds with a standard HTTP 504 response.

Cloudflare's custom Error 504 screen
Cloudflare'due south custom Error 504 screen

Here, the issue lies with your web server and not Cloudflare. You lot can try fixing it with the other solutions mentioned below or contact your hosting provider's support for technical assist.

504 Gateway Timeout at Cloudflare (Variation 2)

If Cloudflare causes the 504 Gateway Timeout mistake, the error screen will mention "cloudflare," which is currently the standard server proper name for all Cloudflare assets. Usually, the error screen volition announced as below:

504 Gateway Timeout error caused by Cloudflare
Error screen for 504 Gateway Timeout caused by Cloudflare

Since Cloudflare itself is unresponsive, you'll not run across whatsoever Cloudflare-branded error screen hither.

Most likely, Cloudflare is already aware of the issue and is working on a set already. Yous can ostend this by checking the Cloudflare System Status webpage. Alternatively, you can get in touch with Cloudflare support for a quicker resolution.

Check Cloudflare System Status at cloudflarestatus.com
Check Cloudflare Organisation Status at cloudflarestatus.com

504 Gateway Timeout at Cloudflare Due to Big Uploads

The size of your uploads to your site can also be a reason for the server timeouts. Cloudflare limits upload file size (per HTTP Mail request) to merely 100 MB on both Complimentary and Pro plans.

Cloudflare's 'Maximum Upload Size' limits for various plans
Cloudflare'south 'Maximum Upload Size' limits for various plans

The issue can be on your host's stop or with Cloudflare. You tin find out the exact cause past bypassing Cloudflare with your DNS hosts file and trying your upload once again.

If y'all're using Cloudflare with WordPress, I recommend using their free plugin and excluding critical URLs from caching (such as the WordPress admin dashboard). You tin can refer to Kinsta's detailed post on how to configure Cloudflare settings for WordPress.

Suggested reading: How to Set up Cloudflare APO for WordPress.

Server Problems (Check With Your Host)

Server issues are i of the virtually mutual reasons for facing a 504 Gateway Timeout error. Since most WordPress sites are hosted on Nginx or Apache webservers, Nginx or Apache is waiting for a response from something and timing out.

Many clients come to Kinsta for exactly this trouble they're facing at other WordPress hosts. The conversation goes something like this:

Nosotros're getting around 100k visitors per month with more than 200k views. Currently, we're hosting with ____ and we experience 504 errors constantly due to server overload. I don't like how ____ handled the problem, and nosotros were too advised that nosotros will have to motility to their dedicated plans shortly, which I believe is not necessary.

High-traffic and ecommerce sites are more prone to getting 504 errors because of server overload equally they generate many uncacheable requests. Nevertheless, this issue can ingather with whatever site, including simple blogs. Many hosts will enquire you to upgrade to a high-tier plan to ready the issue, which in most cases is unnecessary.

Subscribe Now

Kinsta uses LXD managed hosts and orchestrated LXC software containers for each site. Thus, every WordPress site is housed in its own isolated container with access to all the software required to run it (Linux, Nginx, PHP, MySQL). The resources are 100% private and aren't shared with whatever other site, even your sites.

Nearly WordPress hosts providing shared hosting plans don't accept this capability. Hence, a loftier-traffic site hosted on the aforementioned server as yours may cause your site to throw up a 504 error too.

Apart from isolating each site in its container, Kinsta has likewise designed its infrastructure to handle thousands of concurrent connections hands. Kinsta even hosts the MySQL databases at localhost, not a remote server. This means no latency betwixt machines, resulting in faster queries and fewer chances of timeouts occurring.

Many clients who migrate to Kinsta see huge decreases in overall load times.

A 212.5% increase in performance after switching to C2.
A 212.v% increase in performance after switching to C2.

An overloaded server isn't the only cause for a server timeout. There can be many other reasons for the 504 error:

Slow Server Infrastructure

The server y'all apply to host your WordPress site may not have enough resources to handle the load. It'south like playing a modern, graphics-intensive videogame on a decade-erstwhile PC.

The server just hangs up trying to serve the website. The only solution to this problem is to upgrade to a server with better infrastructure. For this reason, even Kinsta's most bones WordPress hosting plan volition handle a static site with medium traffic.

Needs More than PHP Workers

PHP workers are used to execute your WordPress site'south code. An ecommerce site that gets fifty,000 visitors per month needs a lot more resources than a simple weblog with the same amount of traffic. If all the server's PHP workers are busy, they'll build upwardly a queue.

When the queue gets too large, the server disregards old requests, which may cause the server to throw up a 504 gateway mistake. You tin can ask your host virtually increasing your number of PHP workers. This'll allow your site to execute multiple requests simultaneously.

Firewall Problems

Your server's firewall could have some errors or an improper configuration. Perhaps, a few of its rules prevent the server from establishing a connection properly. To know if your firewall is the culprit, y'all can check your server's error logs.

Network Connectivity Problems

Connectivity issues between the proxy server and the spider web server could cause delays in responding to HTTP requests. If you utilise a load balancer, there could also be network connectivity issues with it.

HTTP Timeouts

HTTP timeouts can occur when a connexion betwixt the web server and the client is kept open for also long. With WordPress sites, this usually happens when running WordPress imports. One manner to resolve this result is to switch to a faster cyberspace connection.

Y'all tin can also use a tool with support for WP-CLI to run the scripts directly on the server, bypassing the HTTP connection entirely. For example, you can use the wp import WP-CLI command to run the WordPress Importer plugin directly through the command-line interface.

Important: 504 Gateway Timeout errors look similar to 503 Service Unavailable errors or 502 Bad Gateway errors. But they're all different. If you lot're experiencing a 504 error at Kinsta, open a support ticket to get your issue fixed immediately.

For monitoring your site'southward downtime on your own, you tin can use a tool like updown.io. It'll bank check your website's status (or any URL) periodically by sending an HTTP asking to it. You tin set the check frequency from xv seconds to one hour. If your website isn't responding correctly, it'll notify y'all with an e-mail or an SMS.

Monitor your website with updown.io
Monitor your website hands with updown.io

You'll get a generous quantity of free credits with every business relationship of updown.io, but if yous're looking for cheaper alternatives, you can bank check out WebGazer or UptimeRobot. Both these tools will assistance you monitor your site's uptime every five minutes for free. That's decent enough for near website owners.

WebGazer website monitoring tool's dashboard
WebGazer website monitoring tool's dashboard

Monitoring your website will give you an idea of how oftentimes it'southward downward. This is especially helpful if yous're using a shared hosting provider. Near managed WordPress hosts take intendance of this automatically for you. Hence it's always recommended to go with them.

For a detailed explanation, bank check out Kinsta's post on the importance of managed WordPress hosting.

Spam, Bots, or DDoS Attacks

Malicious attackers can bring your web server to a clamber past sending too many and/or resource-intensive requests. If your site is getting spammed past bots or undergoing a DDoS attack, information technology can overwhelm your server and issue in 504 Gateway Timeout errors for many genuine users.

Y'all can expect at your server traffic and analytics to see if yous tin can spot any irregular patterns in the site traffic. If you're using Kinsta to host your site, you can view this data easily by going to your MyKinsta Analytics dashboard.

MyKinsta Analytics dashboard
MyKinsta Analytics dashboard

Start your investigation past looking at the top client IPs. It'll give you an idea of who generates the maximum number of requests, and from where. If your server suddenly uses up enormous bandwidth or attracts a lot of traffic, then this study volition come up in super handy.

Viewing 'Top Client IPs' in MyKinsta dashboard
Viewing 'Acme Client IPs' in MyKinsta dashboard

Next, y'all tin bank check out the Enshroud Analysis report. Here, you can see how many requests are bypassing or missing the cache, or being served from the enshroud. For performance and stability reasons, you want to cache as many requests every bit possible, but it's non always possible to achieve that.

For example, WooCommerce sites generate many uncacheable requests for features such equally the shopping cart and the checkout process.

The 'Cache Analysis' screen in MyKinsta
The 'Cache Assay' screen in MyKinsta

Finally, you can use a WordPress security plugin to beef up your website'south security by spotting and blocking worrisome traffic/IPs. You tin ask your host to block certain IPs too.

Depending upon the length and scale of the assail, this could be a never-ending process of blacklisting IPs as many attackers change their IPs and proxy addresses after getting blocked.

Note: Kinsta doesn't allow its clients to install WordPress security plugins equally they can have a huge effect on the site's performance, peculiarly its scanning capabilities. As Kinsta uses load balancers with Google Cloud Platform, blocking IPs wouldn't e'er work as intended.

Y'all can use dedicated security solutions such as Cloudflare or Sucuri to protect your sites from DDoS attacks and spambots. For more, you can check out Kinsta'due south manufactures on how to install Cloudflare on your WordPress site and how Sucuri helped stop a DDoS attack in its tracks.

Corrupted WordPress Database

Sometimes, a 504 Gateway Timeout error tin can be because of a corrupt database, specially in WordPress sites. Typically, this is due to corrupted database tables or files. Sometimes, it can too exist caused by a serious security outcome similar your site or database being hacked.

Repairing a corrupted WordPress database depends on the problem. Plugins like WP-DBManager brand information technology easy to diagnose database issues and repair them. I recommend y'all to read Kinsta's detailed walkthrough on repairing WordPress database issues to get started.

Cheque Your Site's Plugins and Themes

In virtually cases, third-party plugins and themes don't cause 504 errors. But there's a slight chance that they might cause server timeouts, usually by queuing up many uncached requests generated by the plugin/theme. As this ties up a lot of your server's PHP workers, it can cause 504 errors.

A cracking example of this upshot is WooCommerce, a plugin installed to add ecommerce functionality to WordPress sites.

The simplest mode yous can troubleshoot this problem is by deactivating all your plugins. Remember, y'all won't lose any information if you just deactivate a plugin.

If you tin can access your admin dashboard, you lot tin can get to the Plugins screen, select Deactivate from the bulk actions menu, checkmark all the plugins, and and so hit the Apply button. This will disable all of your plugins.

Deactivate plugins in WordPress
Deactivating all the WordPress plugins through WP admin dashboard

If you can't access your admin area, you tin can disable plugins via SFTP using the method described before. Simply rename the main plugin folder name to disable all the plugins in bulk.

Once you lot've deactivated all the plugins, check whether your site loads properly. If it works, yous must activate each plugin, testing the site after enabling every plugin.

Finally, brand certain that your plugins, themes, and WordPress core are up to date. Too, ensure that your server is running the recommended version of PHP.

If y'all feel this to be too overwhelming, you can e'er reach out to your host for help. Kinsta uses Kinsta APM and other troubleshooting techniques to assist clients narrow downwardly what plugin, query, or script might cause the fault.

In the worst-example scenarios, like an inefficient query or bad code in a plugin/theme, you tin can bring in a WordPress developer to ready the event.

Bank check Error Logs

Viewing error logs can exist very helpful when troubleshooting and debugging 504 errors on your WordPress site. This tin aid you narrow down an upshot on your site quickly, especially if it's resulting from a demanding plugin on your site.

If you're a Kinsta customer, you can easily see errors in the log viewer in your MyKinsta dashboard.

Checking error logs inside MyKinsta dashboard
Checking mistake logs inside the MyKinsta dashboard

If your host doesn't have a logging tool, then you can enable WordPress debug mode by adding the following code to your wp-config.php file:

          define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); ascertain( 'WP_DEBUG_DISPLAY', imitation );        

The WP_DEBUG abiding enables or disables the WordPress debug mode. Information technology has two optional companion constants that can extend its features. The WP_DEBUG_LOG abiding directs all errors to be saved to a debug.log file within the /wp-content/ directory. If you don't meet this file, y'all can always create one.

The WP_DEBUG_DISPLAY abiding controls whether debug logs show upwards on the HTML page. Setting this to imitation will hide all errors, but you tin can review the errors later, as yous've also divers WP_DEBUG_LOG as truthful.

Important: If you accept WP_DEBUG enabled in the Kinsta environs, it'll route all errors to the debug.log file and not the error.log in the MyKinsta dashboard.

You tin can besides download the raw WordPress error log files via SFTP. Typically, you can find fault logs in your server'due south root directory in a binder named "logs."

Accessing the WordPress error logs folder via SFTP
Accessing the WordPress fault logs folder via SFTP

Kinsta users can also enable WordPress debug mode from their MyKinsta dashboard. To do that, navigate to Sites > Tools > WordPress Debugging and click the Enable push. This will allow you to see PHP errors and notices without enabling debug fashion via SSH or SFTP.

Lastly, you lot can bank check the server log files. Depending on which server you lot're using to host your WordPress site, they're commonly found in these locations:

  • Apache: /var/log/apache2/mistake.log/
  • Nginx: /var/log/nginx/mistake.log/

You can refer to logging related documentation of Apache or Nginx for more information.

Configure Apache or Nginx Settings Properly

You tin can edit your server config files to increase resource limits for specific directives. This tin assist y'all resolve the 504 Gateway Timeout error.

For Apache Webservers

Showtime, add the post-obit code to your httpd.conf:

          TimeOut 600        

This setting defines how long the server will look for certain requests before mark it equally a network timeout issue. Its default value is 60 seconds (Apache 2.four version).

You lot tin can but add together this directive in your httpd.conf file, not in your .htaccess file. Since most shared hosting providers don't permit you to alter the httpd.conf file, yous can attempt increasing the value of the LimitRequestBody directive in your .htaccess file instead.

Then add the post-obit line to your php.ini file:

          max_execution_time 300        

The default value of PHP'south max_execution_time directive is 30 seconds. Increasing it will allow your site's PHP scripts to run longer.

For Nginx Webservers

If you're running your WordPress sites on Nginx + FastCGI Process Manager (PHP-FPM) or using Nginx as a reverse proxy for Apache, you can tweak the server settings to aid forestall 504 Gateway Timeout errors.

504 Gateway Timeout Mistake on Nginx + FastCGI (PHP-FPM)

First, you lot must edit your PHP-FPM puddle config file. You can detect it at the /etc/php7.4/fpm/pool.d/world wide web.conf location in your Nginx server (the exact path may vary based on the PHP version). Alternately, y'all can run the following control in your terminal to edit the PHP-FPM pool config file:

          sudo nano /etc/php/7.2/fpm/pool.d/www.conf        

Next, prepare the following directive:

          request_terminate_timeout = 300        

Later this, yous must edit your php.ini file. Yous can locate it at /etc/php.ini. Open up the file and add together/change the value for the max_execution_time directive to 300 seconds.

          max_execution_time = 300        

Finally, add together the following lawmaking to your nginx.conf file's location block:

          location ~ .php$ { ... fastcgi_read_timeout 300; }        

Reload Nginx and PHP-FPM for the changes to have effect.

          sudo service nginx reload sudo service php7.four-fpm reload        

The exact lawmaking to reload PHP-FPM volition vary based on the PHP version installed on your server. Test your site to see whether information technology has fixed the issue.

504 Gateway Timeout Mistake on Nginx Proxy

If you lot're using Nginx every bit a reverse proxy server for Apache, so y'all can go far more lenient towards server timeouts by calculation the following directives to your nginx.conf file:

          proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600;        

Don't forget to reload Nginx subsequently making your changes.

sudo service nginx reload

Other HTTP Errors Like 504 Gateway Timeout

As mentioned earlier in the article, many other HTTP 5xx errors are simply like the 504 Gateway Timeout mistake. It's because they all happen on the server-side. These errors include:

  • 500 Internal Server Error
  • 501 Not Implemented Error
  • 502 Bad Gateway Error
  • 503 Service Unavailable Mistake

Other HTTP errors caused due to client-side bug, like the 404 Non Found mistake, are besides like the 504 error. You tin refer to Kinsta'southward detailed guide and list of HTTP status codes for more information.

When you lot don't know what caused a 504 Gateway Timeout mistake, how do y'all fix it in fourth dimension to keep hard-earned visitors from bouncing to competitor sites? 🤷‍♂️ All the details are in this postal service. ⬆️ Click to Tweet

Summary

Your WordPress site can exist afflicted by the 504 Gateway Timeout fault because of multiple reasons. In this commodity, you learned how to troubleshoot them all. Typically, these errors are caused due to server-side issues, in which case y'all can accomplish out to your host and get it resolved quickly.

However, yous must too empathise that this mistake can exist due to 3rd-party plugins, themes, services, inefficient database queries, or a combination of 2 or more of these. If y'all're maxing out your server's resources (e.g. PHP workers), it's recommended to optimize your site for performance.

If you all the same find that your website is timing out, then it might very well be that you need to upgrade your hosting plan or the number of PHP workers. I recommend you to consider this pick simply after you've wearied all the other solutions described in this article.

From simple static sites to circuitous ecommerce and membership sites, Kinsta's scalable hosting plans are designed to accommodate all types of websites. To learn more well-nigh our scalable cloud hosting, bank check out this article!

Did we miss anything? If you're all the same finding it hard to fix the 504 Gateway Timeout mistake on your WordPress site, leave a comment below.


Save time, costs and maximize site functioning with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience accomplish with 29 information centers worldwide.
  • Optimization with our built-in Application Operation Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-dorsum-guarantee. Check out our plans or talk to sales to find the programme that's right for yous.