I just configured my Debian 8 server with nginx. I can browse html files. I use let's encrypt which works succesfully, also with redirecting http to https automatically.
What does not work is PHP. Also a simple info.php file with
<?php
phpinfo();
?>
does not work.
On browser client my error message is:
404 Not Found nginx/1.6.2
Nginx' error log shows this:
2018/05/29 19:22:57 [error] 1879#0: *1592 open() "/usr/share/nginx/html/info.php" failed (2: No such file or directory), client: ip_address, server: , request: "GET /info.php HTTP/1.1", host: "domain"
My nginx configuration is:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
server_name my-server.de www.my-server.de;
return 301 https://$server_name$request_uri;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
location ~ /.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
include snippets/ssl-my-server.de.conf;
include snippets/ssl-params.conf;
}
Even if i move info.php to /usr/share/nginx/html then the client browser just downloads the info.php file.
I went through all steps in this guide. But still it isn't working. So how to fix that?
/var/run/php5-fpm.sock