找回密码
 注册
查看: 5704|回复: 1

请问, 如何让Nginx中URL不区分大小写

[复制链接]
发表于 2013-1-4 10:16:58 | 显示全部楼层 |阅读模式

请教啦!
美国VPS推荐: 遨游主机、Linode、LOCVPS、主机云、搬瓦工、80VPS、Vultr等美国VPS主机。中国VPS推荐: 阿里云、腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2013-1-4 14:15:13 | 显示全部楼层


nginx在./configure 参数里加上--with-http_perl_module 重新编译安装
在nginx.conf http段里增加
perl_set $url '
sub {
my $r = shift;
my $re = lc($r->uri);
return $re;
}
';

需要区分大小的server里增加:
if ($uri ~ [A-Z]){
rewrite ^(.*)$ $url last;
}
重启nginx
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2026-11-27 05:52 , Processed in 0.006512 second(s), 18 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表