目标地址有如下列表:
http://1.1.1.1:8081/400000001...
http://1.1.1.1:8081/1/4000000...
http://1.1.1.1:8081/2/4000000...
http://1.1.1.1:8081/3/4000000...
http://1.1.1.1:8081/4/4000000...
其中1,2,3,4部分可能逐年增加,400000001部分是固定的,现在需要NGINX反向代理访问,请问下大佬们如何配置location的规则,假设nginx的内网ip为8.8.8.8,现在访问如下地址,希望能正确拿到资源
http://8.8.8.8/400000001/xxx/...
http://8.8.8.8/1/400000001/xx...
比较笨的配置方式
location /400000001{
proxy_pass http://1.1.1.1:8081/400000001/
}
location /1/400000001{
proxy_pass http://1.1.1.1:8081/1/400000001/
}
location /2/400000001{
proxy_pass http://1.1.1.1:8081/2/400000001/
}
location /3/400000001{
proxy_pass http://1.1.1.1:8081/3/400000001/
}
location /4/400000001{
proxy_pass http://1.1.1.1:8081/4/400000001/
}