让nginx支持patchinfo,(支持codeigniter,thinkphp,ZF等框架)
nginx 的config配置:
server { listen 80; server_name xxx; ....if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } location ~ \.php { set $real_script_name $fastcgi_script_name; set $path_info ""; include fastcgi_params; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } ... fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_NAME $real_script_name; } }
需要注意的是:
1.是~\.php而不是~\.php$
2.include fastcgi_params需要放在特殊设置的变量之前