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