Nginx pathinfo模式配置

正常配置

1 location ~ \.php$ {
2         fastcgi_pass    127.0.0.1:9000;
3         fastcgi_index   index.php;
4         fastcgi_param   SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
5         include         fastcgi_params;
6 }

修改第1行,添加第5行配置,支持pathinfo

1 location ~ \.php(.*)$ { # 正则匹配.php后的pathinfo部分
2         fastcgi_pass   127.0.0.1:9000;
3         fastcgi_index  index.php;
4         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
5         fastcgi_param PATH_INFO $1;   # 把pathinfo部分赋给PATH_INFO变量
6         include        fastcgi_params;
7 }

 

posted @ 2017-06-28 15:16  L狗哥  阅读(1922)  评论(0编辑  收藏  举报