您当前所在位置:首页nginxnginx location 取反

nginx location 取反

更新:2022-05-23 13:42:36编辑:Story归类:nginx人气:288

有这么个需求,只允许html、shtml、js、css访问,其它任何文件都不允许访问。

在nginx location配置取反,如下:

nginx的正则使用PCRE(Perl Compatible Regular Expressions)。

Extension Description
(?# TEXT) This extension lets you add comments to your regular expression. The TEXT value is ignored.
(?:...) This extension lets you add parentheses to your regular expression without causing a pattern memory position to be used.
(?=...) This extension lets you match values without including them in the $& variable.
(?!...) This extension lets you specify what should not follow your pattern. For instance, /blue(?!bird)/ means that "bluebox" and "bluesy" will be matched but not "bluebird".
(?sxi) This extension lets you specify an embedded option in the pattern rather than adding it after the last delimiter. This is useful if you are storing patterns in variables and using variable interpolation to do the matching.

成长的对话版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

nginx记录响应与POST请求日志 nginx实现A/B测试(ngx_http_split_clients_module模块)