nginx怎么开启pathinfo
作者:NorthPath
时间:2025-04-15
浏览:2
apache往nginx去转,代码端用到了$_server['path_info'],对于nginx默认是不开启pathinfo的。所以我们就要手动开启1,url重写location/{//方法1if(!-e$request_filename){rewrite^/(.*)$/index.php/$1last;break;}}location/{//方法2try_files$uri$uri//index.php$uri;}2,pathinfo设置location~.*\.(php|php5)
本文目录
apache往nginx去转,代码端用到了$_server['path_info'],对于nginx默认是不开启pathinfo的。所以我们就要手动开启
1,url重写
location / { //方法1
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location / { //方法2
try_files $uri $uri/ /index.php$uri;
}2,pathinfo设置
location ~ .*\.(php|php5)(.*)?$ //注意这块,配置重写的url
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param path_info $fastcgi_path_info;
fastcgi_param path_translated $document_root$fastcgi_path_info;
include fastcgi.conf;
}这块要注意,location后正则要根据重写的url来决定。
作者最新文章
如何通过EMRAI助手查询EMR组件相关问题
2026-11-01 16:16
EndNote Windows版官方下载与安装教程:许可确认到Word插件验证
2026-10-30 09:21
WinRAR压缩文件教程:参数设置与分卷压缩技巧
2026-10-29 09:38
华硕5070显卡提升AI创作效率
2026-10-27 11:04
navicat怎么设置自增主键及具体操作步骤
2026-10-22 22:43
上一篇:
PHP 计算商的整数部分
下一篇:
Vue 中如何实现通知及消息提示?
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多

































