I'm seeing the following error in my nginx logs on my Ubuntu machine:

[crit] 14697#0: *1 connect() to unix:/home/php/run/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: x.y.z.w, server: mydomain.org, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/home/php/run/php-fpm.sock:", host: "mydomain.org"

Here are the permissions on the socket:

$ ll /home/php/run
total 8.0K
drwxr-xr-x  2 php php 4.0K Jan 10 18:56 .
drwxr-xr-x 12 php php 4.0K Jan  9 17:33 ..
srw-rw----  1 php php    0 Jan 10 18:56 php-fpm.sock

The "nginx" process is run as the nginx user:

$ ps aux | grep nginx | grep -v grep
root     14694  0.0  0.3  88732  1784 ?        Ss   19:08   0:00 nginx: master process /home/nginx/sbin/nginx -c /home/nginx/conf/nginx.conf
nginx    14697  0.0  1.0  88732  5112 ?        S    19:08   0:00 nginx: worker process

I added the nginx user to the "php" group:

$ groups nginx
nginx : php

I tried restarting both nginx and php-fpm after doing so but I got the same failure. I am confused because the socket has permissions of 660, which should give read and write permissions to members of the php group. I'm also confused because the file appears writeable; if I run su - nginx and then run

$ test -w /home/php/run/php-fpm.sock ; echo $?
0

which seems to indicate that the nginx user can write to the socket. Why can't nginx write to the socket? What other information do I need to solve this problem?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.