|
|
本帖最后由 tl3821 于 2020-3-10 14:03 编辑
服务器做了代理
微信小程序这些校验文件 想直接放在代理上
匹配 /*.txt 比如 x.com/1.txt (需要) x.com/11/1.txt(不需要)
目前临时用的是
#精准匹配 可用性不大
location /1.txt {
root /usr/share/nginx/html;
}
# 我只需要 /1.txt 这个规则 /11/11.txt 也会匹配
location ~* .(txt)$ {
root /usr/share/nginx/html;
}
尝试了 location ^~ 好像也不行 大佬们指点下
正解
谢谢各位回答的大佬
只要根路径的话给正则就加个句首匹配就完了
location ~ ^/[^/]+\.txt$
|
|