代码如下 |
复制代码 |
server {
listen 80;
server_name www.sample.com;
root /www;
index index.php index.html;
location / {
index index.php index.html index.htm;
include /www_rewrite/.htaccess;
}
location ~ .php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_buffers 8 128k;
send_timeout 60;
include /etc/nginx/fastcgi_params;
set $script_name $fastcgi_script_name;
set $path_info "";
if ($uri ~ "^(.+?.php)(/.*)$") {
set $script_name $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_NAME $script_name;
}
}
|
编写上面程序之后我们的nginx就支持了path_info了,有需要的朋友可以参考一下。