In this KB:
- What is the 502 error and why it occurs
- How to resolve the 502 error
A 502 error, most commonly referred to as Bad Gateway Error, is caused due to timeout of PHP request. A gateway is an access point or bridge that establishes a connection between two services.
Within our console, it is a server and application such as between NGINX and PHP. At times, it also occurs due to an issue on the client end or ISP end. For client end issues, please try to clear the web browser cache.
To prevent this error, you need to adjust some server settings i.e. you can increase Execution Limit from server settings, by following this guide.
Apart from this, you can increase the buffer size on Key Buffer Size under the Advanced tab in the Server Settings & Packages section.
Also restarting Memcached, Apache, Nginx and Purging Varnish from the Manage Services section can help at times.
It is also advised to check Idle CPU, free memory, and free disk of your server from the Monitoring section in the Server Management area.
On the other hand, sometimes permissions are also responsible for 502 gateway error. This error occurs if there is a communication issue within an application due to different permissions. This problem can be resolved by clicking on the Reset Permissions button from the Application Details section in the Application Management area. For further help on how to reset permissions, please follow this guide.
The above steps apply our default permissions to all your files in an application and change the ownership of all these files to that of your master user.