502 Request Error for Local Sites

This often shows up as an error within the Browser looking like this:

A 502 error specifically means that the webserver is waiting for something “upstream” and never got a response before eventually timing out. In the case of Local sites, the server is either nginx or apache, depending on what was used to create the site, and the upstream part is often the MySQL database.

In most cases, this error is due to the site not being fully “turned on” when the browser tries to access the site, so waiting a little bit (not more than a minute or so) and refreshing the browser can help.

Keeping in mind the above error message about waiting for the database to respond – a 502 could be due to other things like the database crashing, or some other thing preventing the database from fully starting.

You can get a good idea of the issues that MySQL is encountering by looking MySQL’s error log which is found in thelogs/mysql/error.log file.

Troubleshooting Steps

The first thing to try is waiting for the site to fully turn on and continue to refresh the browser. This shouldn’t take more than a minute or so.

If waiting for the site to fully turn on doesn’t fix the issue, here are a couple of additional troubleshooting steps I would recommend:

  • Restart the computer and re-try using Local
  • Try restoring the site to a new one in Local by following the steps outlined in the “Restoring From Only Local Site files” section of this help doc:
2 Likes