location ~ .php
{
#原有代码
#定义变量 $path_info ,用于存放pathinfo信息
set $path_info "";
#定义变量 $real_sc
set $real_sc
#如果地址与引号内的正则表达式匹配
if ($fastcgi_sc
#将文件地址赋值给变量 $real_sc
set $real_sc
#将文件地址后的参数赋值给变量 $path_info
set $path_info $2;
}
#配置fastcgi的一些参数
fastcgi_param sc
$document_root$real_sc
fastcgi_param sc
fastcgi_param PATH_INFO $path_info;
}
二、
location ~ \.php {
root /var/www;
try_files $uri = 404;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
# # With php5-fpm:
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
最佳答案
