小编典典

nginx error connect to php5-fpm.sock failed (13: Permission denied)

all

我将 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;
        }

阅读 112

收藏
2022-04-15

共1个答案

小编典典

php更新后我遇到了类似的错误。PHP
修复了一个对套接字文件具有权限的安全错误。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相应地更新文件

2022-04-15