php5-fpm – sock failed (13: Permission denied) while connecting to upstream error

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:, server:, request: "GET /feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm/website.sock:", host: ""

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 = 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × five =

This site uses Akismet to reduce spam. Learn how your comment data is processed.