我采用Nginx + php-fpm的配置,nginx默认情况下,不提供PATH_INFO,通过以下设置,可以让 Nginx 提供 PATH_INFO:
server {listen 80;
server_name www.linuxidc.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;
}
}
