In 99% of cases, 502 Bad Gateway error indicates that there are problems on the server side, on which the website operates.
502 Bad Gateway - is an HTTP protocol error, which is returned by the front-end server when it cannot receive the content from the backend servers.
What a user can do when facing 502 Bad Gateway error:
- If possible, inform the administration about the error. It can be done, using Twitter, social networks or via e-mail.
- Open the website later. All good internet projects have administrators on duty in their stuff, who is responsible for tracking this error and return the site to the working condition as soon as possible.
- If the site doesn’t work for a long time, try finding the necessary information on another site.
What a site administrator can do when facing 502 Bad Gateway error:
In most cases, a 502 Bad Gateway error is returned to a user by nginx. It means that you use nginx as a front-end server and PHP-fpm or apache as a backend server. Your backend server failed to function and you need to restore its operability. Below there is a recommended sequence of operations for prompt service recovery:
- Reload your Apache or PHP-fpm server (restart the service). The service may have hung up due to heavy traffic, for instance.
- Check operability of backend services, such as MySQL and Memcached. It happens rarely, but they also may become the reason for 502 Bad Gateway error.
- If one of the services won’t start - use DF –h command to check free space on the server disk, if there is no free space – immediately clear it and restart the services.
- Use “top” command to check the server load; if it’s too high (la indicator exceeds 10) – reload the server completely, using reboot command.
If you have any questions left or need some - please, ask a question or leave a comment.
I’m always pleased to help you!