【发布时间】:2016-09-29 20:31:25
【问题描述】:
我讨厌正则表达式!我的大脑不像正则表达式那样工作。有人可以帮助我解决以下问题吗?
出于安全原因,我有一个 nginx 配置文件当前阻止所有访问系统或隐藏文件的尝试(即以“.”开头的文件),其位置配置:
location ~ \/\. {
access_log off;
log_not_found off;
deny all;
}
但是,这也会阻止我对 example.com/db/_local/.XYZ 的 CouchDB 服务器请求
我想允许对X/_local/.X 的所有请求,但拒绝对X/.X 的所有其他请求。
所以我的正则表达式必须匹配所有/.,但不能匹配/_local/.。
例如
example.com/.secretfile // deny
example.com/db/_local/.LONGHASH // allow
example.com/other/.other // deny
RegEx 专家可以帮忙吗?
【问题讨论】: