VPS侦探论坛

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

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

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

请教啦!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国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, 2024-9-24 05:29 , Processed in 0.025425 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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