nginx pathinfo及ThinkPHP的URL Rewrite模式支持
大家都知道thinkphp是一个广泛应用的php开发框架,所以在nginx中需要支持URL Rewrite和pathinfo
在我们的nginx配置文件中添加如下几行就可以了
附带文字部分:
location ~ .php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
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 /var/www/php/example1$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}