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 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM