How to fix 504 gateway timeout error
Summary
This guide helps you troubleshoot and resolve: How to fix 504 gateway timeout error. Follow the steps below to fix the issue.
Common Causes
A 504 Gateway Timeout error means that a server acting as a gateway or proxy did not receive a timely response from an upstream server. In most cases, this indicates that your website is experiencing high traffic, a backend process is hanging, or server resources have been exhausted. This guide explains how to identify whether the issue originates from your hosting environment, a third-party integration, or a DNS misconfiguration, and outlines the steps to restore availability.
Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our team will get it sorted.
Quick Fix Steps
- Refresh your browser page to see if the error clears.
- Clear your browser cache and cookies.
- Try accessing your website from a different network or mobile device.
- Check if other websites on the same hosting account are also affected.
Detailed Instructions
1. Check Server Resources
A 504 error often occurs when your server has run out of memory or CPU capacity, causing upstream processes to time out before they can respond.
- Log in to your hosting control panel (such as cPanel, Plesk, or your provider's custom dashboard).
- Navigate to the Resource Usage, CPU and Concurrent Connection Usage, or Statistics section.
- Review the graphs for CPU, memory, and entry processes.
- If you see sustained spikes at or near 100%, your plan may be underpowered for your current traffic.
- Consider upgrading your hosting plan or optimising your website to reduce resource consumption.
2. Review Third-Party Integrations and Plugins
Slow or hanging API calls to external services can cause your server to wait too long for a response, triggering a 504 error.
- Log in to your website's administration area (for example, WordPress wp-admin).
- Go to Plugins > Installed Plugins.
- Deactivate any recently installed or updated plugins, especially those that connect to external APIs, payment gateways, or shipping calculators.
- Refresh your website to check if the error disappears.
- Reactivate plugins one at a time to identify the problematic integration.
3. Increase Server Timeout Settings
If your backend scripts take longer than the default limit to execute, the gateway may close the connection prematurely.
- Access your server via FTP or your hosting control panel's File Manager.
- Locate your
.htaccessfile (Apache) ornginx.conffile (Nginx). - For Apache, add or modify the following directive in
.htaccess:
ProxyTimeout 300
- For Nginx, add or adjust these values within the
http,server, orlocationblock:
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
- Save the file and restart your web server if you have access to do so.
- Test your website again.
4. Check DNS Configuration
Incorrect DNS records can point visitors to the wrong server or an unresponsive IP address, resulting in gateway timeouts.
- Log in to your domain registrar's control panel or your DNS hosting provider.
- Locate the DNS Management, Zone Editor, or Manage DNS section.
- Verify that your domain's
Arecord points to the correct IP address of your web server. - Check that any
CNAMErecords forwwwor subdomains resolve correctly. - Use a DNS lookup tool to confirm propagation across Australian and international servers.
Troubleshooting
Geographical Latency for Domestic Traffic
If your server is hosted overseas, Australian visitors may experience higher latency, increasing the likelihood of timeouts during resource-intensive operations.
- Use a website speed testing tool to measure load times from Australian locations.
- Consider enabling a Content Delivery Network (CDN) to cache static assets closer to your visitors.
- If latency remains high, migrating to an Australian-based server may improve responsiveness.
Slow Load Times and Unreliability
Intermittent 504 errors often signal that your hosting environment has been outgrown.
- Monitor your site during peak business hours to see if errors correlate with traffic spikes.
- Review error logs in your hosting control panel for
504orgateway timeoutentries. - Optimise images, enable caching, and minify CSS and JavaScript to reduce server load.
- If issues persist despite optimisation, upgrade to a plan with higher resource allocations.
When to Escalate
If you have completed the steps above and the 504 error continues, the issue may be with your hosting provider's infrastructure or a misconfigured upstream server that is outside your control.
Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our team will get it sorted.
Still Having Issues?
💻 Open a Ticket