LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1351|回复: 2

请问 nginx 左右 斜杠区别

[复制链接]
发表于 2011-8-15 11:28:38 | 显示全部楼层 |阅读模式
nginx

location ~\.html$ {
  root   html;
  index  index.html index.htm;
}

location \ {
  root   html;
  index  index.html index.htm;
}

location /.html$ {
  root   html;
  index  index.html index.htm;
}

location / {                                   
  root   html;
  index  index.html index.htm;
}

4个的区别 麻烦解释一下。谢谢
发表于 2011-8-17 11:29:29 | 显示全部楼层
http://wiki.nginx.org/HttpCoreModule#location

第一个,第四个就很简单了,其他的我没看明白,我不知道是不是在WINDOWS中可以用\来做目录分隔符

第一个: ~ 开始表示使用正则表达式, . 在正则表达式中表示任意字符,所以在这里需要用\转义。这条会匹配以 .html结尾的路径
回复 支持 反对

使用道具 举报

发表于 2011-10-4 11:37:29 | 显示全部楼层
Post by gik;2146811
http://wiki.nginx.org/HttpCoreModule#location

第一个,第四个就很简单了,其他的我没看明白,我不知道是不是在WINDOWS中可以用\来做目录分隔符

第一个: ~ 开始表示使用正则表达式, . 在正则表达式中表示任意字符,所以在这里需要用\转义。这条会匹配以 .html结尾的路径


很好,学习了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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