【发布时间】:2018-05-03 13:29:58
【问题描述】:
我无法连接到 php5-fpm.sock。我尝试了很多解决方案,但仍然出现此错误:
2017/11/20 11:17:21 [crit] 9670#9670: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.224.8, server: babylon, request: "GET /webmail/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "babylon"
我的配置是这样的:
location /webmail {
alias /srv/roundcubemail;
index index.php index.html;
# Favicon
location ~ ^/webmail/favicon.ico$ {
root /srv/roundcubemail/skins/classic/images;
log_not_found off;
access_log off;
expires max;
}
# Robots file
location ~ ^/webmail/robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny Protected directories
location ~ ^/webmail/(config|temp|logs)/ {
deny all;
}
location ~ ^/webmail/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/webmail/(bin|SQL)/ {
deny all;
}
# Hide .md files
location ~ ^/webmail/(.+\.md)$ {
deny all;
}
# Hide all dot files
location ~ ^/webmail/\. {
deny all;
access_log off;
log_not_found off;
}
#Roundcube fastcgi config
location ~ /webmail(/.*\.php)$ {
error_log /var/log/nginx/x.log error;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^/webmail/(.+\.php)(/.*)$;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /srv/roundcubemail/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /srv/roundcubemail/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
这可能是目录权限的问题吗?我不这么认为。 我所做的尝试是:
-
我更改了我的 www.conf 的监听,用于套接字和 IP,但仍然无法正常工作
; Unix 用户/进程组 ;注意:用户是强制性的。如果未设置组,则默认用户的组 ;将会被使用。 用户 = www-数据 组 = www-数据
;接受 FastCGI 请求的地址。 ;有效的语法是: ; 'ip.add.re.ss:port' - 在 TCP 套接字上监听特定地址 ;特定端口; ; 'port' - 侦听 TCP 套接字上的所有地址 ;特定端口; ; '/path/to/unix/socket' - 监听 unix 套接字。 ;注意:此值是强制性的。 听 = /var/run/php5-fpm.sock ;听 = 127.0.0.1:9000
;设置listen(2) 积压。 ;默认值:65535(FreeBSD 和 OpenBSD 上为 -1) ;listen.backlog = 65535
;设置 unix 套接字的权限,如果使用的话。在 Linux 中,读/写 ;必须设置权限才能允许来自 Web 服务器的连接。许多 ; BSD 派生系统允许连接而不管权限。 ;默认值:用户和组设置为运行用户 ;模式设置为 0660 listen.owner = www-数据 listen.group = www-数据 监听模式 = 0660
我已经重启了php5-fm和nginx,还是没有。
有什么办法可以解决这个问题吗?
【问题讨论】:
-
sudo lsof -c php-fpm | grep -i sock的输出是什么,请将其添加到您的问题中 -
这个答案会解决你的问题:stackoverflow.com/a/57956896/12074217