比如:判断路径中是否有/test(不只是开头和结尾),如果有则转发到http://127.0.0.1:8080/
location ~ ^/api-(.+)/test/ {
#路径重写,将第二个()内的值重写如/test/后
rewrite ^/api-(.+)/test/(.*)$ /test/$2;
}
location /test/ {
#注意这里是待斜杠的,可以把路径中的test去掉,不去掉的话不能带斜杠
proxy_pass http://127.0.0.1:8080/;
}