Home › Knowledgebase › KB-1168

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.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

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

  1. Refresh your browser page after waiting 1–2 minutes.
  2. Try accessing your website from a different device or mobile network.
  3. Clear your browser cache and cookies.
  4. Check your hosting provider’s status page for reported outages.
  5. 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

  1. Open your web browser.
  2. Press Ctrl + Shift + Delete on Windows, or Command + Shift + Delete on Mac.
  3. Select the time range All time.
  4. Tick the boxes for Cached images and files and Cookies and other site data.
  5. Click Clear data or Clear now.
  6. Restart your browser and revisit your website.

Clear Browser Cache on Mobile

  1. iOS (Safari): Go to Settings > Safari > Clear History and Website Data.
  2. 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

  1. Turn off your modem and router.
  2. Wait at least 30 seconds.
  3. Turn the modem back on and wait for all indicator lights to stabilise.
  4. Turn the router back on.
  5. Reconnect your device and test the website.

Flush Your DNS Cache

  1. Windows: Open Command Prompt as Administrator, type ipconfig /flushdns and press Enter.
  2. Mac: Open Terminal, type sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Return. Enter your administrator password when prompted.
  3. Linux: Open Terminal, type sudo systemd-resolve --flush-caches (or sudo resolvectl flush-caches on newer systems) and press Enter.
  4. 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.

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:

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?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket