Nginx位置正则表达式匹配(tilde)

11

在 Nginx Location 指令中,波浪号(~)有什么作用?例如:

location ~* \.(png|gif|jpg)$ {
  [...configuration]
}

http://serverfault.com/questions/581474/nginx-meaning-of-the-tilde-in-the-location-block-of-the-nginx-conf - Wiktor Stribiżew
1个回答

25

波浪号(~)是Nginx的标识符,它让Nginx知道这个位置块正在使用正则表达式来匹配位置。

"~" = 正则表达式匹配,区分大小写

"~*" = 正则表达式匹配,不区分大小写

Nginx文档


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接