In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-27 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.