This baffled me big time. When I visit the domain, it download the index.php
file. When I visit domain/index.php, it's working fine. I have tried to comment here and there, just can't fix it. This one is Zend Framework 3
. I have other php site on the same server. They are fine. I start to wonder it's ZF3 special now.
My nginx is like this:
server {
listen 80;
server_name xxx.xxx.com;
index index.php index.html;
root /data/www/xxx/public;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /data/www/xxx/public/index.php;
}
access_log logs/worth.jusfeel.cn.log main;
}
I have tried other settings as well. It's the same. The url in the addressbar change to ..domain/index.php
, but still download the index.php
file.
server {
listen 80;
server_name www.example.com;
root /var/www/www.example.com/myapplication;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}