Linux – Nginx PHP-fpm permission

linuxnginxpermissionsPHPphp-fpm

When i'm setting the user in nginx.conf to root root:

user  root root;

then my website is working, but when i set it to nginx nginx i get error in the logs:

connect() to unix:/var/run/php-fpm/php-fpm.sock failed (13: Permission denied)

i'm using PHP-FPM 5.5, and i made sure the folder owner is nginx + executing permission are enabled.

what am i missing..?
Thx

—————–EDIT:

quick edit when changing php-fpm.sock permissions manually it's working. how do i start php-hpm with the right permissions?

Best Answer

There are two bugs opened recently related to this issue:

I personally experience the first one on FreeBSD with php version 5.4.30. For a workaround I applied both parameters available to specify the owner of the socket like this:

[default]
listen = /tmp/php-fastcgi.sock
user = www
group = www
listen.owner = www
listen.group = www
listen.mode = 0660