Nginx 搭配 PHP-FPM 已經是架設 PHP 伺服器基本入門款了,這次升級 CentOS 機器完後,發現 Log 一直噴出底下訊息
nginx error connect to php5-fpm.sock failed (13: Permission denied) 透過 Stackoverflow 查到這篇解答 nginx error connect to php5-fpm.sock failed (13: Permission denied),裡面提到兩種作法,其中一解法是直接修改
/var/run/php5-fpm.sock
為 666,讓其他使用者可以直接存取此檔案,但是此作法在下次重新開機後一樣會出現同問題,最終解法請修改/etc/php-fpm.d/www.conf
如果是搭配 Nginx 請使用底下設定
user = nginx group = nginx ; 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 = nginx listen.group = nginx listen.mode = 0666