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

oxf4rvwz  于 2022-12-14  发布在  Nginx
关注(0)|答案(2)|浏览(148)

我在努力寻找一个位置。我想找到类似于

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错误...
任何帮助都将不胜感激
谢谢

pw136qt2

pw136qt21#

不带前缀的位置已经是前缀匹配,因此location /config应起作用,而不是location /config/

vfhzx4xs

vfhzx4xs2#

也许试试~ /config(|/.*)
似乎对我很有效:)

相关问题