nginx配置pathinfo,解决thinkphp404问题
警告
本文最后更新于 2020-05-30 17:09,文中内容可能已过时。
参考地址:https://www.cnblogs.com/hfdp/p/5867844.html
请求的网址是http://xxx.com/index.php/admin/bbb/ccc/index
PATH_INFO的值是/admin/bbb/ccc/index
SCRIPT_FILENAME的值是$doucment_root/index.php
SCRIPT_NAME /index.php
所以php(.*)$
中$1的值就是PATH_INFO
配置pathinfo
# 正则匹配.php后的pathinfo部分
location ~ \.php(.*)$ {
root /xxx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
# 把pathinfo部分赋给PATH_INFO变量
fastcgi_param PATH_INFO $1;
include fastcgi_params;
}
请我喝杯水

