我配置我NGINX为Zend公司以下列方式(PHP 5.3 FPM):Zend框架额外获取PARAMS与NGINX
server {
root /home/page/public/;
index index.php index.html index.htm;
server_name localhost;
location/{
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
现在我要处理其他get PARAMS,如:http://web.site/index?par=1
与我的本地开发系统(Apache)工作正常,但不在NGINX下,它没有提供获取参数。
Anny的建议?
编辑:
现在我用下面的配置,这似乎工作,但我不喜欢它,因为每个人都建议“使用try_files尽可能”。
location/{
if (!-e $request_filename) {
rewrite /(.*)$ /index.php?q=$1 last;
break;
}
}
如何其实你是否试图得到它? – zerkms
用print_r($ _GET)测试它,但后来用$ values = $ this-> getRequest() - > getQuery(); – Johni
问题不是脚本问题是认为脚本文件名是index.php没有参数,所以php不能填充$ _GET数组等。 – Johni