Why is my website showing a 504 gateway timeout error?
Summary
This guide helps you troubleshoot and resolve: Why is my website showing a 504 gateway timeout error?. Follow the steps below to fix the issue.
Common Causes
A 504 Gateway Timeout error occurs when a server acting as a gateway or proxy does not receive a timely response from an upstream server. Essentially, the server your browser is connecting to is waiting for another server to complete a task, but that task takes too long to finish. This results in the connection timing out and the error page being displayed to the visitor.
Quick Fix Steps
- Refresh your browser page by pressing
F5orCtrl + Ron Windows, orCommand + Ron macOS. If the error persists, it indicates a server-side issue. - Wait a few minutes and try accessing the website again. Temporary network interruptions often resolve themselves.
- Clear your browser cache to ensure you are not loading a cached error page.
- Try accessing the website from a different device or network to rule out local connectivity issues.
Detailed Instructions
Check for Resource-Heavy Scripts
If your website runs complex scripts or large database queries, the upstream server may exceed the allowed execution time. This is frequently caused by the max_execution_time setting in PHP or gateway/proxy timeout configurations.
- Log in to your website's administration dashboard (for example, the WordPress admin panel at
/wp-admin). - Navigate to Plugins > Installed Plugins. Deactivate any recently installed plugins, particularly those related to backups, security scanning, or data imports, to identify if one is resource-heavy.
- Use a plugin such as Query Monitor to identify slow database queries or resource-intensive scripts.
- Check your scheduled tasks or cron jobs via your hosting control panel to ensure multiple heavy processes are not running simultaneously.
- Optimise your database tables using a tool like phpMyAdmin (found under Databases in cPanel) to remove overhead and improve query response times.
Review Server Resource Usage
Shared or underpowered hosting environments often have strict memory and processing caps. When these limits are reached, the server may stop responding to the gateway.
- Log in to your hosting control panel (cPanel or Plesk).
- In cPanel, navigate to Metrics > Resource Usage or CPU and Concurrent Connection Usage. In Plesk, go to Websites & Domains > PHP Settings.
- Check CPU, memory (RAM), and entry process limits to see if any are consistently maxed out.
- If resources are frequently at capacity, consider upgrading your hosting plan to accommodate your traffic and application needs.
Investigate Upstream Server Connectivity
A 504 error often points to a breakdown in communication between your web server and a backend service, such as a database server or API.
- Verify that your database service is running and accessible from your web server.
- Check your firewall settings to ensure the web server can communicate with upstream servers on the required ports (typically port 3306 for MySQL).
- Review server error logs for messages indicating connection refusals or timeouts to upstream services. Common log paths include
/var/log/nginx/error.logfor Nginx servers and/var/log/apache2/error.logfor Apache servers. - If you use a Content Delivery Network (CDN), check the CDN provider's status page for regional outages affecting Australian traffic.
PHP Execution Time and Proxy Timeouts
Server-side timeouts are often governed by specific configuration limits. If a script takes longer than the allowed limit to execute, the gateway will terminate the connection and return a 504 error.
- PHP max_execution_time: This setting defines how long a script is allowed to run before it is terminated by the parser. You can check this value in your hosting control panel under PHP Settings or Select PHP Version.
- Gateway/Proxy Timeout: If your site sits behind a reverse proxy or load balancer, there is often a separate timeout setting (e.g.,
proxy_read_timeoutin Nginx) that differs from the PHP execution time. - If you host with us and suspect a timeout configuration issue, Open a Ticket and our Brisbane team can review your server limits.
Troubleshooting
Client-Side vs Server-Side Timeouts
Understanding where the timeout occurs helps determine the correct course of action.
- Client-side: The issue is isolated to your local network, browser, or device. This is rare for 504 errors but can occur if a local proxy or firewall is interfering with the connection.
- Server-side: The issue originates on the hosting server or the upstream server it communicates with. Most 504 Gateway Timeout errors are server-side and require changes to server configuration, script optimisation, or hosting resources.
Geographical Latency
If your website's servers are located overseas, Australian visitors may experience higher latency. While this usually causes slow loading rather than a 504 error, extremely long response times can contribute to gateway timeouts when combined with resource-heavy operations. Check your CDN status page to see if there are regional outages specifically affecting traffic from Australia.
Note: Monitoring your website during peak traffic periods can help you identify if timeouts occur only when resource demand is highest.
.htaccess or nginx.conf unless you are familiar with the syntax, as incorrect edits can take your website offline entirely.When to Request Support
If the error persists after trying the steps above, gather the following information before contacting support:
- The exact URL where the 504 error occurs.
- The time and date the error first appeared.
- Whether the error happens on all pages or only specific pages.
- Any recent changes made to the website, such as new plugins, theme updates, or server configuration changes.
- Screenshots of the error message and any relevant server logs.
Providing these details helps the support team diagnose the issue faster. You can submit your request via your hosting provider's support portal.
If you host with us, you don't need to do this yourself — Open a Ticket and our Brisbane team will get it sorted.
Still Having Issues?
💻 Open a Ticket