nginx位置匹配路径及其后的所有内容

时间:2018-05-22 14:56:44

标签: regex nginx nginx-location

我正在试图匹配一个位置。 我想匹配像

这样的东西
location ~ /config/<match anything regardless if path, file, or random crap, whether it is there or not> {
"do stuff here"
}

我已经尝试了我能在网上找到的所有内容

location /config
location /config/
location ~ ^/config/
location ~ ^/config(.*)/(.*)+$ETCETC!!!!ARGHA

所有尝试都会导致404错误...

任何帮助将不胜感激

由于

1 个答案:

答案 0 :(得分:0)

没有前缀的位置已经是前缀匹配,因此location / config应该有效,而不是location / config /