I am getting the following error in my Nginx error.log file, what do I need to do to prevent this from happening?
2016/06/28 09:43:37 [crit] 1631#0: *1 connect() to unix:/run/php/php5.6 fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.56.1, server: my-vm, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php5.6-fpm.sock:", $host: "my-vm-1"
Nginx runs with www-data permissions. The permissions of the folder that the error message is referencing (/run/php/php5.6-fpm.sock
) are as follows:
drwxr-xr-x 20 root root 700 Jun 28 09:45 run
drwxr-xr-x 2 www-data www-data 80 Jun 28 09:44 php
srw-rw---- 1 www-data www-data 0 Jun 28 09:44 php5.6-fpm.sock
The user/group of PHP (/etc/php/5.6/fpm/pool.d/www.conf
) is:
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
The nginx.conf
file does not have any user
value set. Some people have suggested setting this to www-data
, but if I set this the Nginx service won't start, hence why it is ommitted.