Nginx PHP-fpm permission
Solution 1
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
Solution 2
Check official documentation. You can use listen.owner
or user
to specify the owner of unix socket.
listen.owner string
Set permissions for unix socket, if one is used. In Linux, read/write permissions must be set in order to allow connections from a web server. Many BSD-derived systems allow connections regardless of permissions. Default values: user and group are set as the running user, mode is set to 0666.
listen.group string
See listen.owner.
user string
Unix user of FPM processes. This option is mandatory.
group string
Unix group of FPM processes. If not set, the default user's group is used.
Related videos on Youtube
Danny Valariola
Updated on September 18, 2022Comments
-
Danny Valariola over 1 year
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?
-
Danny Valariola about 10 yearsthat was it....in AWS RedHat 6.4 Image the default was 0660 for some reason... i changed it and it worked, thx.
-
Danny Valariola almost 10 yearsyeap found it a while ago :)