nginx错误连接到php5-fpm.sock失败(13:权限被拒绝) [英] nginx error connect to php5-fpm.sock failed (13: Permission denied)

查看:408
本文介绍了nginx错误连接到php5-fpm.sock失败(13:权限被拒绝)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I update nginx to 1.4.7 and php to 5.5.12, After that I got the 502 error. Before I update everything works fine.

nginx-error.log

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

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修复了安全错误,其中o对套接字具有rw权限文件.

I had a similar error after php update. PHP fixed a security bug where o had rw permission to the socket file.

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

  1. Open /etc/php5/fpm/pool.d/www.conf or /etc/php/7.0/fpm/pool.d/www.conf, depending on your version.
  2. Uncomment all permission lines, like:

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

  • 重新启动fpm-sudo service php5-fpm restartsudo service php7.0-fpm restart

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

    Note: if your webserver runs as user other than www-data, you will need to update the www.conf file accordingly

    这篇关于nginx错误连接到php5-fpm.sock失败(13:权限被拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆