Sometimes when visiting individual pages of the WordPress website, we are faced with the fact that rather than the desired content, an error message or a digital code appears on the screen. For an “uninitiated” user, this is simply a set of numbers, but in fact, these numbers contain certain information. All of them are grouped as per different failure causes.
Messages encoded in 5xx format indicate a server-side issue. Let’s consider the case when requests cannot get completed because of communication failures among various servers. The 504 error is uncommon. Though it doesn’t imply that it will get ignored, particularly for WordPress websites. Let’s take a look at some of the reasons for this error and how to fix it by both web resource administrators and regular visitors.
What is a 504 Error in WordPress?
Basically, the 504 error is an implication of the HTTP status code. This happens when a server does not obtain a timely answer from other servers that act as a proxy or gateway for a certain period.
Error descriptions can have various forms:
- 504 Gateway Timeout Nginx
- Gateway Timeout Error
- HTTP Error 504
- 504 Gateway Time-out – The server didn’t respond in time
- HTTP Error 504 – Gateway Timeout
- The existence of other verbal descriptions enables specifying the reason for the failure.
What should a site visitor do when a 504 error occurs?
Now, you have seen the message “error 504” on the screen. Do not leave your WordPress website. It may imply that your browser is not in a properly working state. Or, there are more issues at the user software level. Follow simple steps to assure everything is compatible with your settings and software.
- Reload the problematic page or current browser. If the issue is rectified and does not reoccur, especially when visiting other sites, you can forget about it. If you regularly face the same errors while visiting different resources, you should get into understanding your own software settings.
- Visit a similar website where the 504 error is occurring using an alternate browser. In the event that the web page opened correctly during testing, update the browser that failed to the recent version.
- Monitor how the website pages open from another PC or smartphone. It enables you to know if the 504 error is linked to the software of a specific device or not.
- With the regular HTTP errors appearance, incl. with code 504, clear the browser cache, and remove the cookies. Over time, much “garbage” accumulates in different browsers. By cleaning, the program works more correctly and faster.
- Reset the modem or router by disconnecting the equipment from the network for some time. This practice will not resolve the 504 error. However, it can enhance the Internet connection quality. Providers regularly make amendments to the software settings and update them. Mostly, it results in conflict in the correct interaction among the user equipment and the operator’s servers. Device rebooting by power in several cases solves these types of problems.
- Clear the DNS cache: This operation seems complicated for the average user. Though, it can be performed easily. The cleaning method relies on the operating system and finds the corresponding manual.
- For pro or advanced users, the recommendation is to move the DNS server temporarily to Google Public DNS. This will assist in determining if the erroneous HTTP status code is because of the DNS issue.
If, after following the mentioned recommendations, some error like 504 Gateway Time Out continues to occur regularly, approach the technical team of the problematic Internet resource.
Solving Issues with the appearance of error 504 with the administrator of the web resource
Incorrect website work most often annoys the users and lets them find an alternative resource. For the WordPress website owner, such failures can include more global consequences. So, it is essential to detect bugs in a timely manner and fix them as quickly as possible. When it is about early monitoring, it is worth using all possible tools:
- conduct a regular simulation of user behaviour on the website;
- set up automated resource health monitoring both with built-in administration tools and with special scripts;
- ensure the high-quality work of the technical support service of the website. The timely processing of all incoming messages, especially those linked to data of the appearance of different user’s side errors.
Compliance with the last rule will not only enable you in tracking all possible problems that arise when visiting the site, almost at no additional cost. Timely processing of user requests, quick response, recommendations and public discussion boosts loyalty and generates an additional PR effect.
Almost every error with the 5xx code happens because of the inability in processing a specific number of requests at the server that are resolved by upgrading the hardware or optimizing the software. The other method relies on the engine type on which a particular website was created. With shareware programs such as WordPress, all problems should get solved at the administration level, with the involvement of a specific web programmer who developed this site.
Reasons For 504 Error in WordPress
- A sharp jump in the load on the site because of the external requests from DDoS attacks or the actions of virus software, peak visits to the website. For example, while carrying out promotions in an online store, or a one-time download of different content to the WordPress website.
- Incorrect work of scripts, plug-ins and add-ons that conflict both with each other and inside.
- Advancing the limit of available resources with shared hosting.
Another possible reason for the 504 error is that the script being executed does not fit within the allotted time limit. This happens when the script accesses other sites or simply performs a heavy operation, such as building a search index.
Guidelines for Solving Error 504 Using Site Administration Methods
Error 504 Gateway Time Out may be due to current updates or changes to the website. If an error occurs after returning to the previous state of the changes, you need to find an exact action that generated the error. To do so, you have to review the error log of the relevant CMS. WordPress users can activate the error log in the wp-config.php file by including the following lines:
define( ‘wp_debug’, true );
define( ‘wp_debug_log’, true );
define( ‘wp_debug_display’, false )
Any errors will occur in the wp-contents / debug.log file.
To test the functionality of extensions and plugins, turn off suspicious ones as the source of the 504 error. Firstly, this concerns outdated scripts, but updates may be the cause. If the issue does not exist, then find the incorrect plugin or add-on and eliminate or fix it. You can work on the performance of an executable script to enhance the value of the max_execution_time PHP parameter or simplify the script.
To receive the content quickly, there will be two types of 504 errors with CDN, especially Cloudflare, which operates as a DDoS and CDN prevention service. When there is an issue on the Cloudflare side, either approach support or turn it off. The other occurs on the part of the hosting provider. Here, you should also approach the hosting support service.
Usually, this error occurs on servers that have VPS hosting, with Apache as the back and Nginx as the front. To solve the problem in Apache, you can improve the default timeout value in the file http d.conf
# Timeout: The seconds before sending or receiving a time out.
timeout 600
Also enhance the limit in max_execution_time in php.ini :
max_execution_time 300
When the changes are made, restart Apache. The 504 Gateway Time Out error must have been removed.
Similarly, the HTTP 504 error is solved by Nginx users. Change the below settings in the /etc/nginx/conf.d/timeout.conf file :
- proxy_connect_timeout 600;
- proxy_send_timeout 600;
- proxy_read_timeout 600;
- send_timeout 600;
We advise higher the max_execution_time in php.ini :
- max_execution_time 300
- Next, restart Nginx and open the site.
An easier solution to fix this problem is to use the server control panel.
This method enables you to administer settings of the web server without a console, configure them once for the project and do not connect to the server without an urgent need.
If the appearance of 504 Gateway Timeout is because of exceeding the resource server usage limit, then the best solution is to rent a dedicated server or VPS. When the WordPress site is hosted on shared hosting, but no recommendations resulted in the error 504 being fixed, approach your hosting provider.
Conclusion: In this write-up, we have checked the main causes of the HTTP 504 Gateway Timeout error and the best troubleshooting steps. You can also contact the WordPress agency for WordPress development services to get assistance. They can fix the possible issues and give you the right direction.