2014年2月10日星期一

php-fpm 配置不当 导致 nginx 502 错误一例

​不要总看nginx 的日志文件。
 
cat /home/php/logs/php-fpm.log 部分内容如下
 
"Error: Wrong IP address ' 10.11.80.49' in listen.allowed_clients"
"Error: Connection disallowed: IP address '10.11.80.49' has been dropped."
 
ERROR: Connection disallowed: IP address "10.11.80.49" has been dropped
 
回头且看php-fpm 配置文件
cat /home/php/etc/php-fpm.conf 
 
[global]
pid = /home/php/logs/php-fpm.pid
error_log = /home/php/logs/php-fpm.log
log_level = notice
 
[www]
listen = 10.11.80.49:9000
listen.allowed_clients = 10.11.80.47,10.11.80.48, 10.11.80.49
user = nobody
group = nobody
 
slowlog = /home/php/logs/slow.log
catch_workers_output = yes
request_terminate_timeout = 30s
request_slowlog_timeout = 5s
 
pm = dynamic
pm.max_children = 100
pm.start_servers = 50
pm.min_spare_servers = 5
pm.max_spare_servers = 100
 
就是这里
 
[www]
listen = 10.11.80.49:9000
listen.allowed_clients = 10.11.80.47,10.11.80.48, 10.11.80.49
user = nobody
group = nobody
 
netstat 看到的端口是listen 状态,启动php-fpm 无报错。
其它两台机器 47 48 也没有问题,我就奇怪了,telnet 一下测试
 
#telnet 10.11.80.49 9000
Tring 10.11.80.49 ...
Connected to 10.11.80.49
Esape character is '^]'.
 
我分别在47 和48 上测试, 发现不一样的就是 49 是被直接close 掉的。
后面再看配置文件,48 后面多了一个空格。去掉重启,测试,我勒个去。

没有评论:

发表评论