unix - nginx 错误连接到 php5-fpm.sock 失败 (13 : Permission denied)

标签 unix nginx php

我将 nginx 更新为 1.4.7 并将 php 更新为 5.5.12,之后我收到 502 错误。在我更新之前一切正常。

nginx-error.log

2014/05/03 13:27:41 [crit] 4202#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: xx.xxx.xx.xx, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xx.xx.xx.xx"

nginx.conf

user  www www;
worker_processes  1;

        location / {
            root   /usr/home/user/public_html;
            index  index.php index.html index.htm;
        }
        location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME    /usr/home/user/public_html$fastcgi_script_name;
            include fastcgi_params;
        }

最佳答案

我在 php 更新后遇到了类似的错误。 PHP 修复了 security bug其中 o 对套接字文件具有 rw 权限。

  1. 打开/etc/php5/fpm/pool.d/www.conf/etc/php/7.0/fpm/pool.d/www.conf,取决于你的版本。
  2. 取消注释所有权限行,例如:

    listen.owner = www-data
    listen.group = www-data
    listen.mode = 0660
    
  3. 重启 fpm - sudo service php5-fpm restartsudo service php7.0-fpm restart

注意:如果您的网络服务器以 www-data 以外的用户身份运行,您需要相应地更新 www.conf 文件

关于unix - nginx 错误连接到 php5-fpm.sock 失败 (13 : Permission denied),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23443398/

相关文章:

ubuntu - ubuntu 上的 Phpbrew – 如何更改版本?

nginx webdav 无法打开集合

PHP 似乎得到了错误的查询结果

php - Apache 服务器日志错误。 AH00126 : Invalid URI in request GET, 等

unix find 命令结果中的权限问题

linux - 如何将命令输出作为多个参数传递给另一个命令

ruby-on-rails - SSE 消息是否通过 https 连接加密?

php - 你如何处理 ', single quote in person' 的名字在 php,javascript

python - 如何从不同的终端向在 linux 的终端窗口上运行的 python 程序提供 raw_input,所有这些都在同一个 UNIX 上运行

c - fprintf 后文件指针设置为 NULL