connect() to unix:/var/run/php7-fpm.sock failed (13: Permission denied)
将/var/run/php7-fpm.sock更改权限
sudo chmod 777 /var/run/php7-fpm.sock
注: 报错原因是在www.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.
; Default Values: user and group are set as the running user
; mode is set to 0660
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0660
在CentOS 中使用openresty 和 php-fpm, 配置php-fpm以unix sock连接,一直报403或者404错误。 开启openresty错误日志,查看日志发现:
将
/var/run/php7-fpm.sock
更改权限