fist fist - 6 months ago 78
PHP Question

nginx and index.php downloading

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 it downloads
index.php instead of showing homepage, but for example works well.

This is my nginx config:

server {
listen 80;
listen [::]:80;

root /var/www/example/www;

index index.php index.html;


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.

Answer Source

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.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download