• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Plesk 12.5.30: Bad Gateway 502 Nginx on all web sites

KevinM

New Pleskian
I seem to be having the strangest issue with my Plesk hosting. The system was running fine for a year. Then all of the sudden, most of the sites started showing the message "Bad Gateway 502 - Nginx".

After extensive research the only option to get the site working again was to remove "Nginx" from hosting. That seems to work for a little amount of time. I'm not sure on the timing but after some amount of time, some of the sites start to show the same error message again.

I reinstall "Nginx" again and the sites come back up. Not sure what to do at this point.
 
We just deleted nginx and switched to apache. And today early in the morning again. All websites down. Plesks seems to do anything each morning that shoots down all our websites. After a restart the websites work again...
 
We just deleted nginx and switched to apache. And today early in the morning again. All websites down. Plesks seems to do anything each morning that shoots down all our websites. After a restart the websites work again...

seem plesk team need to find a FIX for this, am having same issue (i moved some sites to shared hosting leaving only 3 now they stop from time to time)
 
if fail2ban is enabled try adding your ip to TRUSTED ips
Kingsley's solution could work. I had the same issue after an automatic upgrade to 12.5.30. I looked at Fail2Ban logs and found that my NAT ip was banned around the same time as the upgrade (plesk-apache-badbot jail). Made it a trusted ip and have had no problems since.
 
The only thing that is different.. We have installed the "expires" module in apache. Can it be the reason for any problems?

We just did a clean debian 8.4 minimal installation with plesk 12.5.30 with an image file from the provider (hetzner). We restored the websites from plesk backup without any problems.

After that.... The apache crashes every morning... Can not find the reason...
 
Last edited:
The only thing that is different.. We have installed the "expires" module in apache. Can it be the reason for any problems?

We just did a clean debian 8.4 minimal installation with plesk 12.5.30 with an image file from the provider (hetzner). We restored the websites from plesk backup without any problems.

I enabled mod_expires on my staging server and my apache/NGINX configuration still works. On centos 7.2, plesk 12.5.30, Hetzner.
Do your websites run when NGINX is uninstalled?
 
yes, they work with apache, and apache nginx proxy combination.

Does not matter what configuration i take. It works the hole day. Until early in the morning. Then the apache crashes. I tried some things today. Have to wait for the morning to see if it is working now...
 
try changing php version away from FPM, back to fastCGI.
i had the same issue after some plesk update. NGIX error, nothing would run. after php change all was fine again
edgar
 
@David_W and @boosterfan,

It seems to be the case that you are both using Hetzner, a server/hosting provider that uses a particular network setup and configuration.

In the case of Hetzner, a 502 Nginx is common to be one of the following:

a) activation of the Web Application Firewall (WAF) with setting "on" is resulting in a lot of log entries of various IP addresses, related to or belonging to the server.

Check: if you set WAF to "off" and the 502 error disappears, it is Fail2Ban scanning the WAF log files and blocking the server IP addresses.

Solution A: if the issue is WAF/Fail2Ban related, just whitelist your server IPs in Fail2Ban and Nginx should be running

Solution B: change the Fail2Ban plesk-modsecurity filter (go to "Tools & Settings > Fail2Ban > Jails > Manage Filters > plesk-modsecurity (click/select)") and add some appropriate regexp to the "ignoreregex=" line. For instance, this works: \[.*?\]\s\S*\s<IP Address>\s and <IP Address> should be replaced with the relevant IP address(es) of the server.

Note: it is better to use solution B, since it will increase performance of Fail2Ban. However, solution B is error-prone, so I would strongly recommend solution A.

b) an incorrect configuration on the server side, being the Plesk instance.

Check: if you did use a custom network setup, in order to allow for the particular Hetzner network structure, have a look at your /etc/network/interfaces file. You will notice that is really completely different from the default network setup, used by Plesk, for instance when adding an (extra) IP.

Solution A: check for the IP ranges, required for the Hetzner network, and add them to the Fail2Ban whitelist (and if needed, also add them to a "allow" rule in Plesk Firewall).

Solution B: consider to rewrite the /etc/network/interfaces file. Do NOT do this if you are not familiar with network configuration!

c) an incorrect configuration on the server side, being the servers of Hetzner upon which a VPS is hosted OR being the network infrastructure of Hetzner.

Solution: create a ticket or contact Hetzner for support.


Hope the above helps a bit to get to the root cause of the problem and the solution thereof.

As a final remark, I would strongly recommend that one starts the error analysis by (first) following point a, (second) follow point b and, if that does not work, to post your results on this forum or contact Hetzner directly.

Regards.....
 
Back
Top