Nginx的默认配置是不支持的pathinfo的,要支持path_info也很简单。
原配置如下
location ~ \.php$ { root /data0/wwwroot/default; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data0/wwwroot/default$fastcgi_script_name; include fastcgi_params; }
修改为:
location ~ \.php(.*)$ { root /data0/wwwroot/default; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME /data0/wwwroot/default$fastcgi_script_name; include fastcgi_params; }
修改的地方:
1、将location ~ \.php$ 修改为 location ~ \.php(.*)$
2、添加如下两行
fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info;
这个pathinfo的问题碰到好几次了,每一次都是thinkPHP框架所致,远离thinkPHP,幸福一生。