Symptoms
When attempting to view a website, you may see the error "502 Bad Gateway".
Description
The "502 Bad Gateway" response indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
On a cPanel server, this error typically occurs when your cPanel server is set up to use NGINX with Reverse Proxy. With this setup, this error indicates that an invalid response was passed between Nginx and Apache.
Workaround
The most commonly reported "502 Bad Gateway" error that you may see when accessing a website returns from Apache. An example of this would be:
[Tue Jun 15 00:00:00 2021] [mpm_worker:error] [pid 001:tid 0001] AH00001: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
The cause of the error likely stems from Apache becoming overloaded with requests. Apache will need adjustments to its limitations to get around the problem.
We have another great article that covers how you can adjust this limit here: