Below is my nginx.conf.
In case of non existing files /index.php
is served fine.
But when my URL is /foo/bar => /foo/bar/index.php
is served as PHP source code via download.
Any ideas?
try_files $uri $uri/ $uri/index.php /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Solution was to add index index.php
index index.php
try_files $uri $uri/ $uri/index.php /index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
My config
index index.html index.htm index.php;
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
include fastcgi_params;
}
reload nginx and fastcgi both
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With