nginx + php-fpm: permission denid

ManuelRighi nginx-forum at nginx.us
Tue Nov 25 12:16:52 UTC 2014


Hello,
I have nginx 1.6.2 (compiled from source) and php-fpm 5.5.9 on Ubuntu server
14.04.1 LTS.
I have problem with php-fpm, I receive error 502 Bad Gateway.
In nginx error.log I found this:

2014/11/25 13:13:47 [crit] 5820#0: *29097 connect() to
unix:/var/run/php/php5-fpm.sock failed (13: Permission denied) while
connecting to upstream, client: 10.10.30.168, server: , request: "GET
/index.php HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php/php5-fpm.sock:", host: "10.10.20.171:59000"


nginx.conf have these settings: 

user www-data www-data;

server {
listen 10.10.20.171:59000;
location ~* \.php$ {
                        fastcgi_index   index.php;
                        fastcgi_pass    unix:/var/run/php/php5-fpm.sock;
                        include         fastcgi_params;
                        fastcgi_param   SCRIPT_FILENAME   
$document_root$fastcgi_script_name;
                        fastcgi_param   SCRIPT_NAME       
$fastcgi_script_name;
                }

}

www.conf have these settings:

user = www-data
group = www-data
listen = /var/run/php/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0664


Directory /var/run/php/ have www-data owner and these permission:

srw-rw-r--  1 www-data www-data   0 Nov 25 12:01 php5-fpm.sock



with command "ps aux | grep -F -e php -e nginx" this is the result

root      5818  0.0  0.1 180148  2668 ?        Ss   12:01   0:00 nginx:
master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
www-data  5819  5.4  4.4 592464 90568 ?        Sl   12:01   4:03 nginx:
worker process
www-data  5820  6.8  4.9 599712 100984 ?       Sl   12:01   5:04 nginx:
worker process
www-data  5821  5.4  4.5 595148 92560 ?        Sl   12:01   4:02 nginx:
worker process
www-data  5822  6.3  4.4 595888 91696 ?        Sl   12:01   4:40 nginx:
worker process
www-data  5823  0.0  0.3 189044  6724 ?        Sl   12:01   0:00 nginx:
cache manager process
root      5853  0.0  0.6 133616 12596 ?        Ss   12:01   0:00 php-fpm:
master process (/etc/php5/fpm/php-fpm.conf)
www-data  5855  0.0  0.1 133616  3720 ?        S    12:01   0:00 php-fpm:
pool www
www-data  5856  0.0  0.1 133616  3720 ?        S    12:01   0:00 php-fpm:
pool www
root     28003  0.0  0.0  11748   784 pts/0    R+   13:15   0:00 grep
--color=auto -F -e php -e nginx



Can you help me ?
I need to use socket, not tcp. With tcp all works correctly.

Tnx
Manuel

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255096,255096#msg-255096



More information about the nginx mailing list