connect()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了connect()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3719字,纯文字阅读大概需要6分钟。
内容图文
![connect()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录)](/upload/InfoBanner/zyjiaocheng/750/ddddd4eed27f43018501ca99279d6eca.jpg)
在我的流浪者盒子,分7,我安装了php7.0.3和nginx 1.9.12. php配置www.conf.这个文件在/usr/local/php/etc/php-fpm.d/目录下,其配置如下
user = www
group = www
;listen = /tmp/php-fpm.sock
listen = 127.0.0.1:9000
listen.owner = www
listen.group = www
和nginx配置. /usr/local/nginx / conf / vhost /目录中的文件vm.demo.com.conf.它的配置是这样的
server {
listen 80;
server_name vm.demo.com;
index index.html index.htm index.php;
root /data/wwwroot/demo;
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
location ~ .*\.(php|php5)?${
#fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log logs/demo.log main;
}
在nginx conf中,如果我使用fastcgi_pass 127.0.0.1:9000并且php-fpm.conf监听127.0.0.1:9000,它们正常工作
如果我使用套接字配置错误:
php www.conf
user = www
group = www
listen = /tmp/php-fpm.sock
listen.owner = www
listen.group = www
nginx vm.demo.com.conf
location ~ .*\.(php|php5)?${
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
nginx显示502 Bad gateway.在nginx error.log中显示这个.
2016/03/14 21:17:04 [crit] 4208#0: *5 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while
connecting to upstream, client: 192.168.1.101, server: vm.demo.com, request: "GET /test.php HTTP/1.1",
upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "vm.demo.com"
2016/03/14 21:17:04 [crit] 4208#0: *5 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while
connecting to upstream, client: 192.168.1.101, server: vm.demo.com, request: "GET /test.php HTTP/1.1",
upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "vm.demo.com"
2016/03/14 21:18:01 [crit] 4208#0: *5 connect() to unix:/tmp/php-fpm.sock failed (2: No such file or directory) while
connecting to upstream, client: 192.168.1.101, server: vm.demo.com, request: "GET /test.php HTTP/1.1",
upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "vm.demo.com"
当我检查/tmp/php-fpm.sock文件时,它已存在
[root@vbox1 vhost]# ll /tmp/php-fpm.sock
srw-rw---- 1 www www 0 Mar 14 21:06 /tmp/php-fpm.sock
这是php和nginx运行状态:
[root@vbox1 vhost]# systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/etc/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-03-14 21:06:27 CST; 42min ago
Process: 4189 ExecStop=/bin/kill -SIGINT $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 4198 (php-fpm)
CGroup: /system.slice/php-fpm.service
├─4198 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
├─4199 php-fpm: pool www
└─4200 php-fpm: pool www
Mar 14 21:06:27 vbox1 systemd[1]: Started The PHP FastCGI Process Manager.
Mar 14 21:06:27 vbox1 systemd[1]: Starting The PHP FastCGI Process Manager...
[root@vbox1 vhost]# systemctl status nginx.service
● nginx.service - nginx
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-03-14 21:06:35 CST; 42min ago
Process: 4180 ExecStop=/usr/local/nginx/sbin/nginx -s quit (code=exited, status=0/SUCCESS)
Process: 4206 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 4207 (nginx)
CGroup: /system.slice/nginx.service
├─4207 nginx: master process /usr/local/nginx/sbin/nginx
├─4208 nginx: worker process
└─4209 nginx: worker process
Mar 14 21:06:35 vbox1 systemd[1]: Starting nginx...
Mar 14 21:06:35 vbox1 systemd[1]: Started nginx.
有人能帮我吗?如果有人遇到同样的问题
解决方法:
我遇到了同样的问题.
我只是将套接字路径更改为另一个目录,但是’/ tmp’,
一切顺利.
内容总结
以上是互联网集市为您收集整理的connect()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录)全部内容,希望文章能够帮你解决connect()到unix:/tmp/php-fpm.sock失败(2:没有这样的文件或目录)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。