码迷,mamicode.com
首页 > Web开发 > 详细

nginx和php-fpm配置 错误connect() failed (111: Connection refused) while connecting to upstream connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

时间:2019-11-06 23:12:47      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:pass   direct   src   文件   span   director   highlight   ash   use   

若fpm配置文件中配置如下:

listen = 127.0.0.1:9000

 则对应的nginx.conf中的配置应为:

fastcgi_pass   127.0.0.1:9000;

 此时开启9000端口监听,不会生成sock文件

技术图片

若fpm中的配置为使用Unix套接字,如下:

listen = /run/php/php7.2-fpm.sock

则对应nginx.conf中的配置应为:

fastcgi_pass   unix:/run/php/php7.2-fpm.sock;

此时9000端口未开启,在/run/php/下生成php7.2-fpm.sock文件

技术图片

若两者不匹配则nginx启动失败。

若fpm为sock,nginx为127.0.0.1:9000,则会出现以下错误:

connect() failed (111: Connection refused) while connecting to upstream

若fpm未127.0.0.1:9000,nginx为sock,则会出现以下错误:

connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

 

 

nginx和php-fpm配置 错误connect() failed (111: Connection refused) while connecting to upstream connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

标签:pass   direct   src   文件   span   director   highlight   ash   use   

原文地址:https://www.cnblogs.com/adhzl/p/11808922.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!