I was recently making some changes in my php5-fpm config and after service restart I started getting this error:
*812 connect() to unix:/var/run/php5-fpm/website.sock failed (13: Permission denied) while connecting to upstream, client: 126.96.36.199, server: website.com, request: "GET /feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm/website.sock:", host: "website.com"
Going through the logs I narrowed the error down to permissions on the website.sock file.
the fix was to add this section to my /etc/php5/fpm/pool.d/www.conf file:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Make sure that www-data is actually the user the nginx worker is running as. For debian it’s www-data by default.