- Plesk for Linux
The following message appears when accessing any website on the server:
CONFIG_TEXT: 502 Bad Gateway
The following error message can be found in Plesk > Domains > example.com > Logs:
CONFIG_TEXT: connect() failed (111: Connection refused) while connecting to upstream
nginx and Apache are running and listening to the correct ports:
# netstat -tunap | grep -E ":80|:443|:7080|:7081" | grep LISTEN
tcp 0 0 192.0.2.2:443 0.0.0.0:* LISTEN 9141/nginx: master
tcp 0 0 192.0.2.2:80 0.0.0.0:* LISTEN 9141/nginx: master
tcp6 0 0 :::7080 :::* LISTEN 8744/httpd
tcp6 0 0 :::7081 :::* LISTEN 8744/httpd
Server is running behind NAT.
The public IP address is defined opposite the internal one in Plesk > Tools & Settings > IP Addresses.
The websites are accessible after disabling nginx:
# /usr/local/psa/admin/sbin/nginxmng --disable
But re-enabling nginx back leads to the 502 error again:
# /usr/local/psa/admin/sbin/nginxmng --enable
IP addresses misconfiguration.
Go to Plesk > Tools & Settings > IP Addresses.
Click on the internal address, e.g. 192.0.2.2, and reapply the public IP address for it by pressing the OK button.