Applicable to:
- Plesk for Linux
Symptoms
- If Nginx is enabled, all sites return the following error:
CONFIG_TEXT: 504 Gateway Timeout error
CONFIG_TEXT: 502 Bad gateway
- Fail2ban is not installed or disabled;
- Apache and nginx services are running;
- There are the following records in
/var/log/httpd/error_log
:CONFIG_TEXT: upstream timed out (110: Connection timed out) while reading response header from upstream
- There are the following records in
/var/www/vhosts/example.com/logs/proxy_error_log
:CONFIG_TEXT: 2018/01/25 07:41:57 [error] 18625#0: *8 connect() failed (111: Connection refused) while connecting to upstream
Cause
Firewall blocks local connection on port 7080 and 7081, so Nginx is unable to connect to Apache.
Resolution
- Install Plesk Firewall if it is not installed How to install Plesk Firewall
- Go to Plesk > Tools & Settings > Firewall > Modify Plesk Firewall Rules >Add Custom Rule and allow 7080/7081 ports for all internal IP addresses for Incoming/Outgoing.
Click on a section to expand
- To do this manually, connect to the server via SSH
Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.
- Add rules using the commands below:
# iptables -A INPUT -s 10.10.10.10 -p tcp -m tcp --dport 7081 -j ACCEPT
# iptables -A INPUT -s 10.10.10.10 -p tcp -m tcp --dport 7080 -j ACCEPT
# iptables -A OUTPUT -s 10.10.10.10 -p tcp -m tcp --sport 7081 -j ACCEPT
# iptables -A OUTPUT -s 10.10.10.10 -p tcp -m tcp --sport 7080 -j ACCEPT
Comments
7 comments
this is popping up errors
Hi, @iamkingsleyf, could you please clarify the issue in more details?
all my sites on my ubuntu server is showing 502/504 error
root@helen:~# -A INPUT -s 10.10.10.10 -p tcp -m tcp --dport 7081 -j ACCEPT
-bash: -A: command not found
Firewall is not enabled either
@iamkingsleyf, the assistance with this issue was provided to you in scope of support ticket. If you need further assistance, please reply to the ticket.
Yes thank you very much, this was EXACTLY the solution to my problem. :-)
Thanks! This solved the problem of a slow website, Apache memory usage and a Wordpress back-end being pretty much unavailable with 504 errors.
The strange thing is the problem just occurred a few days ago without any changes done to Plesk or firewall.
Please sign in to leave a comment.