In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In Nginx, there are some advanced scenarios that need to be dynamically forwarded to the impassable upstream according to the path parameter in url.
Scenario 1
/ svr1/xxxx?yyy forwarded to svr1:8080/xxxx?yyy
/ svr2/xxxx?yyy forwarded to svr2:8080/xxxx?yyy
The configuration is as follows:
Location ~ * / (srv [1-9] +) / (. *) ${allow all; proxy_pass http://$1/$2$is_args$args; proxy_set_header Host $host; proxy_set_header x-forwarded-for $forwarded_addr;} upstream srv1 {server srv1-ip:8080 } upstream srv2 {server srv2-ip:8080;}
Scenario 2
There are three peer service srv1,2,3,/svc1/xxxx?yyy forwarded to srv1/2/3:8080/xxxx?yyy under svc1.
There are three peer service srv4,5,6,/svc2/xxxx?yyy forwarded to svr4/5/6:8080/xxxx?yyy under svc2.
Location ~ * / (svc [1-9] +) / (. *) ${allow all; proxy_pass http://$1/$1/$2$is_args$args; proxy_set_header Host $host; proxy_set_header x-forwarded-for $forwarded_addr;} upstream svc1 {server srv1:8080; server srv2:8080 Server srv3:8080;} upstream svc2 {server srv3:8080; server srv4:8080; server srv5:8080;}
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.