• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Bad gateway error Nginx on websites

LaurentR2D2

Plesk Certified Professional
Plesk Certified Professional
Hello,

I've migrated Plesk 12.5 and the websites I host on a server with Centos 7. I've used Security Advisor to add Let's encrypt certificates to my domains and to the server, enable Nginx proxy and HTTP/2, and Datagrid reliability and vulnerability scanner. It seemed to work fine at the beginning, but today I've found that all the websites were displaying a "502 bad gateway error - nginx" instead of the homepage. I've followed the instructions from this kb article :

https://kb.plesk.com/en/123735

but the error was still there. I've finally disabled nginx to get access to the websites. Is there another way to fix this problem ? The only error I see in the error log of nginx is :

Code:
2016/09/02 18:48:13 [error] 2775#0: *2899 connect() failed (111: Connection refused) while connecting to upstream, client: x.x.x.x, server: , request: "GET / HTTP/1.1", upstream: "http://x.x.x.x:7080/", host: "x.x.x.x"

Is Nginx really needed on a server with low trafic websites ? I've read it was made for a high trafic website at the beginning. Concerning http/2, can't I wait to have Apache support it before I activate it ?

Thank you
 
Are you using fail2ban? In that case you need to exclude 127.0.0.1 from the jails. Else Nginx will be blocked by fail2ban because it accesses Apache too frequently.
 
Are you using fail2ban? In that case you need to exclude 127.0.0.1 from the jails. Else Nginx will be blocked by fail2ban because it accesses Apache too frequently.

It's already excluded from the jails. 127.0.0.1/8 is in the trusted ip adresses list.

The IP address of my server is banned by the plesk-apache-badbot jail. Is there something to do with nginx ? Should I move my server ip address in the trusted ip list for this jail ?
 
Last edited:
Yes, you must definitely exclude all local addresses from jails, else Nginx will not be served by Apache. The error message you are getting is saying that Apache refuses to deliver data to Nginx. As Apache is running, this refusal is most likely for the reason that your local IP is blocked.
 
Thank you. It works fine now. Doing what you said has also solved a problem of Plesk not being able to display the shared files :)
 
Back
Top