nginx 502错误 failed (13: Permission denied)

安装好nginx和php-fpm后出现502的错误 查找原因是说php-fpm没有启动 ,但在我实际中这个进程是启动的 找了半天没找到原因,查看nginx日志后 发现以下错误

[crit] 2686#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.50.1, server: [...], request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[...]"

遇到这种的解决方法


chmod 0666 /var/run/php5-fpm.sock

OR

chmod 0660 /var/run/php5-fpm.sock
chown www-data:www-data /var/run/php5-fpm.sock


同时把下面这些打开

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

重启服务

service php5-fpm restart

重启后一切OK



相似问题  

ubuntu12.04安装php5-fpm 出错connect() to unix:/var/run/php5-fpm.sock


你可能感兴趣的:(php,nginx)