Nginx + PHP-FPM: Permissions on UNIX socket
wmark+nginx at hurrikane.de
Wed May 9 17:32:29 UTC 2012
2012/5/8 B.R. <reallfqq-nginx at yahoo.fr>:
> After an update of my PHP package, now that I am using the new configuration
> files, I am setting up my new PHP-FPM UNIX socket.
> My UNIX socket is:
> - Placed in /var/run/php-fpm.sock
> - Owner & group: 'www-data'
> - Filemode: 0660
> After restarting PHP-FPM, the new socket has the correct attributes.
> My Nginx configuration spawns workers with the 'nginx' user, which belongs
> to the 'www-data' group (just checked through the 'groups' command).
> However, Nginx can't connect to the PHP socket, it seems to encounter some
> permissions problems: '*1 connect() to unix:/var/run/php-fpm.sock failed
> (13: Permission denied) while connecting to upstream'
> WHat am I doing wrong? Do I need something in particular in my Nginx
Although everything seems correct, let's double-check this. What's the
output of following commands?
# (stop, then start php-fpm)
# date +%Y-%m-%d\ %H:%M:%S
# ls -ald /var /var/run /var/run/php-fpm.sock
# getfacl /var/run/php-fpm.sock
# groups nginx
# groups www-data
# ps aux | grep -F -e php -e nginx
I bet it's just a small detail you've missed.
More information about the nginx