Reputation: 57
I'm getting a 502 Bad Gateway
error with PHP7
and nginx 1.9.9
installed on Ubuntu 14.04
when I try to access any .php
files. .html
files load as expected.
I've updated the default.conf
to:
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;
}
}
I've updated php.ini
with cgi.fix_pathinfo = 0
and then rebooted the server, and am still getting the 502
error with all .php
files. I have checked to ensure php7.0-fpm.sock
is installed and in the proper location.
This is the error I'm getting from the nginx log 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"
I've searched for the answer for quite a while and I'm out of ideas. Does anyone have any suggestions?
Upvotes: 3
Views: 6359
Reputation: 43
This is mostly because your nginx and php7.0-fpm were not run under the same user. Edit nginx.conf and change "user nginx" to "user www-data" By the way, "client: 85.159.237.13", that was a script boy, I think.
Upvotes: 3