Nginx runs under user www-data
. For php5-fpm pool, I have two websites namely, website1 and website2 with the following configuration in /etc/php5/fpm/pool.d/
:
website1 config in fpm pool
user = website1
group = website1
listen = /var/run/php5-fpm-website1.sock
listen.owner = website1
listen.group = website1
listen.mode = 0666
website2 config in fpm pool
user = website2
group = website2
listen = /var/run/php5-fpm-website2.sock
listen.owner = website2
listen.group = website2
listen.mode = 0666
The above configuration works fine as it creates the Unix Socket files with 666
permission. But, ideally I want to change listen.mode
to 0660 to create the same permission for my socket.
My problem is, if I change listen.mode
to 0660
and then restart nginx/php5-fpm, I get 502 Bad Gateway due to permission issue.
EDIT
I have gone through similar question before in SO (including the one referred by @Mario, however, I am more looking for a solution with configuration suitable for multiple websites (server blocks) keeping their individual security intact...