当我尝试访问任何.php
文件时,我在 Ubuntu 14.04
上安装了 PHP7
和nginx 1.9.9
出现502 Bad Gateway
错误。 .html
文件按预期加载。
我已将default.conf
更新为:
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html index.htm index.php;
server_name localhost;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ '.php$ {
fastcgi_split_path_info ^(.+'.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
我已经用cgi.fix_pathinfo = 0
更新了php.ini
,然后重新启动了服务器,但仍然收到所有.php
文件的502
错误。我已经检查以确保php7.0-fpm.sock
已安装并在正确的位置。
这是我从nginx日志2016/01/19 19:14:54 [error] 1466#1466: *1 open() "/usr/share/nginx/html/xmlrpc.php" failed (2: No such file or directory), client: 85.159.237.13, server: localhost, request: "POST /xmlrpc.php HTTP/1.0", host: "my.ip.address"
中得到的错误
我已经寻找答案很长一段时间了,但我没有想法。有人有什么建议吗?
这主要是因为你的nginx和php7.0-fpm不是在同一用户下运行的。编辑nginx.conf并将"user nginx"更改为"user www-data"顺便说一下,"客户端:85.159.237.13",我想这是一个脚本男孩。