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来决定。
作者最新文章
漫蛙漫画APP下载安卓版免费
2026-10-13 13:42
漫蛙动漫下载安卓版安装包
2026-10-13 13:19
漫蛙manwa2免费漫画入口在哪
2026-10-13 13:17
漫蛙2漫画入口
2026-10-13 13:03
会声会影X5去除视频原有字幕的操作方法
2026-10-13 11:07
上一篇:
PHP 计算商的整数部分
下一篇:
Vue 中如何实现通知及消息提示?
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多










































