標籤:ar io 使用 for on 檔案 問題 bs cti
今天把vps上php5.3升級到了php5.4,我採用的是nginx+php-fpm的架構,nginx通過php-fpm的socks檔案來串連。
結果報錯:
connect() to unix:/tmp/php-cgi.sock failed (13: Permission denied) while connecting to upstream
我檢查了一下 /tmp/php-cgi.sock 發現該檔案擁有者是root,而nginx和php-fpm都是www使用者來啟動並執行,按理講,這個sock檔案也應該是www才對。
後來發現在php-fpm.conf中有這麼一段配置:
; 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 0660
;listen.owner = www
;listen.group = www
;listen.mode = 0660
很奇怪,按照說明,預設應該使用 user和group配置項來設定許可權,但實際上沒有。不管怎麼樣,通過手動指定一下這裡的配置就解決問題了。
; 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 0660
listen.owner = www
listen.group = www
;listen.mode = 0660
nginx串連php-fpm sock檔案失敗502