dsgdg54ef4365 2016-08-16 04:31 采纳率: 0%
浏览 99

Ubuntu + php-fpm + nginx + unix socket = 13:权限被拒绝

i can't make work nginx with php-fpm. Googled whole day, tried everything but no result.

Any request is 502 and in error log i see this:

# tail /var/log/**/*error*.log
==> /var/log/nginx/acme.www.error.log <==
2016/08/16 04:24:14 [crit] 930#930: *1 connect() to unix:/root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 10.0.2.2, server: acme.dev, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock:", host: "www.acme.dev:8080"

More tech info about my configuration here (it's almost default from repos):

# uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

# php -v
PHP 5.6.24 (cli) (built: Aug 16 2016 02:28:22)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

# phpbrew fpm which
/root/.phpbrew/php/php-5.6.24/sbin/php-fpm

# /root/.phpbrew/php/php-5.6.24/sbin/php-fpm -v
PHP 5.6.24 (fpm-fcgi) (built: Aug 16 2016 02:28:29)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

# /root/.phpbrew/php/php-5.6.24/sbin/php-fpm -t
[16-Aug-2016 04:09:42] NOTICE: configuration file /root/.phpbrew/php/php-5.6.24/etc/php-fpm.conf test is successful

# cat /root/.phpbrew/php/php-5.6.24/etc/php-fpm.conf | egrep 'user|owner|group|mode'
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

# nginx -v
nginx version: nginx/1.10.1

# cat /etc/nginx/nginx.conf | egrep 'user|owner|group|mode'
user www-data;

# cat /etc/nginx/snippets/fastcgi-php.conf | grep fastcgi_pass
fastcgi_pass unix:/root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock;
# fastcgi_pass unix:/root/.phpbrew/php/php-7.0.9/var/run/php-fpm.sock;

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# date +%Y-%m-%d\ %H:%M:%S
2016-08-16 04:21:21

# ls -ahlFG /root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock
srw-rw---- 1 www-data 0 Aug 16 04:02 /root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock=

# getfacl /root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock
getfacl: Removing leading '/' from absolute path names
# file: root/.phpbrew/php/php-5.6.24/var/run/php-fpm.sock
# owner: www-data
# group: www-data
user::rw-
group::rw-
other::---

# groups nginx
nginx : nginx www-data

# groups www-data
www-data : www-data nginx

# ps aux | grep -F -e php -e nginx
root      2660  0.0  0.1  91500  1596 ?        Ss   03:57   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data  2661  0.1  0.3  92200  3612 ?        SN   03:57   0:02 nginx: worker process
www-data  2662  0.0  0.3  92200  3120 ?        SN   03:57   0:00 nginx: worker process
www-data  2664  0.1  0.3  92200  3612 ?        SN   03:57   0:02 nginx: worker process
root      2712  0.0  1.0 251288 10276 ?        Ss   04:02   0:00 php-fpm: master process (/root/.phpbrew/php/php-5.6.24/etc/php-fpm.conf)
www-data  2713  0.0  0.9 251288  9216 ?        S    04:02   0:00 php-fpm: pool www
www-data  2714  0.0  0.9 251288  9216 ?        S    04:02   0:00 php-fpm: pool www
root      3101  0.0  0.0  11920   788 pts/0    R+   04:20   0:00 grep --color=auto -F -e php -e nginx

I'm lost with this and even don't know how to search where is error.

With php-7.0.9 – same error.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办