nginx connect() to unix:/var/run/php-fpm/php-fpm.sock failed (13: Permission denied) while connecting to upstreamのエラーが出た時の対処法
ある日nginxをrestartしたら、PHPのページが読めなくなった。
logを見ると以下のようなエラーログが書かれていた。
nginx connect() to unix:/var/run/php-fpm/php-fpm.sock failed (13: Permission denied) while connecting to upstream
調べてみると、どうやらパーミッションがおかしいらしい。
/etc/php-fpm.d/www.conf
の
46行目当たりを検索して下さい。 ; 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.owner = www-data ;listen.group = www-data listen.mode = 0666(先頭の";"を外し、このように設定する。)
これでrestartして動けば解決だが、これでもだめならをする。
cd /var/run/php-fpm chmod 666 php-fpm.sock
Comment