nginx配置 connect() failed (111: Connection refused) while connecting... 解决php-fpm启动之后没有9000端口的问题

 如果本文对你有用,请爱心点个赞,提高排名,帮助更多的人。谢谢大家!❤

如果解决不了,可以在文末进群交流。

nginx配置 connect() failed (111: Connection refused) while connecting... 解决php-fpm启动之后没有9000端口的问题_第1张图片

 查看nginx错误日志,信息如下:

[root@VM_16_17_centos ~]# tail -f /data/logs/nginx_error.log 
2019/11/02 23:42:16 [error] 11700#0: *34 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: www.mengyilingjian-eric.top, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysql.mengyilingjian-eric.top"
2019/11/02 23:42:17 [error] 11700#0: *34 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: mysql.mengyilingjian-eric.top, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mysql.mengyilingjian-eric.top", referrer: "http://www.mengyilingjian-eric.top/"

 

 解决办法:

执行命令,查看9000端口是否监听。

[root@VM_16_17_centos run]# netstat -anp|grep 9000

如果没有监听,则随后查看PHP配置文件

[root@VM_16_17_centos ~]# vim /usr/local/php/etc/php-fpm.conf


[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.max_requests = 1024
pm.process_idle_timeout = 10s
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log

此时修改nginx.conf 文件如下,需要php-fpm.conf中listen 的值与nginx.conf中fastcgi_pass值保持一直。

location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param APPLICATION_ENV production;
    include fastcgi_params;
}

 

不懂地方可留言,或者进微信群内交流。

群二维码:

   nginx配置 connect() failed (111: Connection refused) while connecting... 解决php-fpm启动之后没有9000端口的问题_第2张图片

群二维码如果过期,请加我个人微信:mengyilingjian.

    nginx配置 connect() failed (111: Connection refused) while connecting... 解决php-fpm启动之后没有9000端口的问题_第3张图片

 

你可能感兴趣的:(Linux,nginx)