Reputation: 3
I just installed Nginx with PHP 7.1-fpm on Ubuntu 16.04 and I have a problem. When I wan to visit for example http://example.dev it downloads index.php instead of showing homepage, but for example http://example.dev/registration works well.
This is my nginx config:
server {
listen 80;
listen [::]:80;
root /var/www/example/www;
index index.php index.html;
server_name example.dev;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Thanks for your answers.
Upvotes: 0
Views: 1626
Reputation: 350
Sometimes it can be as simple as clearing the browser cache. If there was some misconfiguration and it was indeed downloading files, after fixing the config the browser needs to be told to stop using the cached download.
Try Ctrl+Shift+R in your browser.
(From: https://askubuntu.com/questions/460710/why-is-the-index-php-downloaded-instead-of-rendered-by-nginx)
Upvotes: 3