Applicable to:
- Plesk for Linux
Symptoms
- Websites periodically show errors:
CONFIG_TEXT: 502 Bad Gateway
or
CONFIG_TEXT: Can't reach site
- Errors in
/var/www/vhosts/example.com/logs/proxy_error_log
:CONFIG_TEXT: [crit] 7910#0: *20853273 connect() to 203.0.113.2:7080 failed (99: Cannot assign requested address) while connecting to upstream, client: 203.0.113.2, server: example.com, request: "GET /index.php HTTP/1.1", upstream: "http:// 203.0.113.2:7080/index.php", host: "example.com"
- The port range for TCP connections is 28231 (the difference between minimum and maximum ports):
# cat /proc/sys/net/ipv4/ip_local_port_range
32768 60999 - Current connections count is the following:
# netstat -anp | awk '$1 ~/tcp/ {print $6}' | sort | uniq -c
574 ESTABLISHED
15 FIN_WAIT1
43 FIN_WAIT2
14 LAST_ACK
151 LISTEN
9 SYN_RECV
1 SYN_SENT
47144 TIME_WAIT# ss -s
Total: 3334 (kernel 3731)
TCP: 49011 (estab 501, closed 48336, orphaned 16, synrecv 0, timewait 48333/0), ports 0
Cause
Lack of local TCP ports.
Resolution
Apply one of the following solutions:
- Log in to Plesk server via SSH
- Increase the ports range, for example:
# echo 20000 60999 > /proc/sys/net/ipv4/ip_local_port_range
# sysctl -w
-
Optimize the TCP ports usage:
# echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
# echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
# echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse# sysctl -w
Comments
0 comments
Please sign in to leave a comment.