Why Your Website Is Returning 502 Bad Gateway Errors and How to Fix It
Summary
This guide helps you troubleshoot and resolve: Why Your Website Is Returning 502 Bad Gateway Errors and How to Fix It. Follow the steps below to fix the issue.
Common Causes
A 502 Bad Gateway error means your website server is acting as a gateway or proxy and received an invalid response from an upstream server. For small business sites, this is often caused by server performance issues, resource bottlenecks, or temporary communication failures between servers. This guide walks you through diagnosing and resolving 502 errors to get your site back online.
Quick Fix Steps
- Refresh your browser page after waiting 1–2 minutes.
- Try accessing your website from a different device or mobile network.
- Clear your browser cache and cookies.
- Check your hosting provider’s status page for reported outages.
- If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.
Detailed Instructions
Clear Browser Cache
- Open your web browser.
- Press
Ctrl+Shift+Deleteon Windows, orCommand+Shift+Deleteon Mac. - Select the time range All time.
- Tick the boxes for Cached images and files and Cookies and other site data.
- Click Clear data or Clear now.
- Restart your browser and revisit your website.
Clear Browser Cache on Mobile
- iOS (Safari): Go to Settings > Safari > Clear History and Website Data.
- Android (Chrome): Open Chrome > tap the three-dot menu > Settings > Privacy and security > Clear browsing data > select Cached images and files and Cookies and site data > tap Clear data.
Restart Your Local Network Equipment
- Turn off your modem and router.
- Wait at least 30 seconds.
- Turn the modem back on and wait for all indicator lights to stabilise.
- Turn the router back on.
- Reconnect your device and test the website.
Flush Your DNS Cache
- Windows: Open Command Prompt as Administrator, type
ipconfig /flushdnsand pressEnter. - Mac: Open Terminal, type
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderand pressReturn. Enter your administrator password when prompted. - Linux: Open Terminal, type
sudo systemd-resolve --flush-caches(orsudo resolvectl flush-cacheson newer systems) and pressEnter. - Try accessing your website again.
Troubleshooting Server Performance Issues
Check for Resource Bottlenecks
If your site is hosted on a shared or underpowered plan, 502 errors often occur when the server hits memory or processing caps. High traffic spikes, poorly optimised scripts, or resource throttling can cause the web server to stop responding to upstream requests.
- Monitor your site during peak traffic periods to see if errors correlate with visitor surges.
- Check if large file uploads, database backups, or scheduled tasks run at the same time as the errors.
- Review your hosting control panel for CPU, memory, and concurrent connection usage.
- Look for slow load times and timeouts alongside the 502 errors, which often indicate an outgrown hosting plan.
Check Server Error Logs
Server error logs can reveal the specific cause of 502 errors. Check your hosting control panel for access to error logs, or contact your hosting provider to retrieve them. Look for entries mentioning upstream connection timeouts, PHP-FPM crashes, or gateway errors around the time the 502 errors occurred.
Check Application Server Status
If your website uses PHP-FPM, Node.js, or another application server, ensure the service is running. A crashed or unresponsive application server will cause the web server (nginx or Apache) to return a 502 Bad Gateway error. Restart the application server service through your hosting control panel or request assistance from your hosting provider.
Check Firewall and Security Settings
Firewall rules, security plugins, or mod_security configurations may block legitimate upstream server requests, resulting in 502 errors. Temporarily disable security plugins or firewall rules to test if they are causing the issue, then reconfigure them to allow legitimate traffic.
Geographical Latency Considerations
For Australian businesses, hosting servers located overseas can introduce latency that contributes to gateway timeouts. If your domestic traffic routes through distant data centres, server responsiveness may degrade under load, increasing the likelihood of 502 errors.
Contact Your Hosting Provider
If the error persists after basic troubleshooting, the issue is likely on the server side and outside your control. Provide your hosting support team with:
- The exact time and date the 502 error started.
- Whether the error affects all pages or only specific sections of your site.
- Any recent changes made to your website, DNS settings, or hosting configuration.
- Screenshots of the error message.
Avoid making DNS changes or modifying server configuration files unless you are certain of the impact. Incorrect changes can extend downtime or make your site inaccessible.
If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.
Still Having Issues?
💻 Open a Ticket