首先创建pahtinfo.conf文件
touch /usr/local/nginx/conf/pathinfo.conf
然后在这个文件中添加以下内容
vi /usr/local/nginx/conf/pathinfo.conf
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "(.+?\.php)(/.*)") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
再将虚拟主机配置文件(/usr/local/nginx/conf/nginx)里的location ~ .*\.(php|php5)?$ 替换为:location ~ .*\.php
再在include fcgi.conf; 下面添加一行include pathinfo.conf;
保存退出;
vi /usr/local/php/etc/php.ini
将cgi.fix_pathinfo=0 修改为cgi.fix_pathinfo=1
[注,上两行黄色背景的,不用修改也可以。目前本人不知道是干什么用的。]
保存退出;
重启nginx服务,/etc/init.d/nginx restart
即可支持;