For example, my program is localhost:8080/demo/
Matched to: localhost:9000/microsevice/demo, one more microsevice service name
Maybe I misunderstood what you meant.
Display localhost:8080/demo/
,實際訪問的是localhost:9000/microsevice/demo
in the user’s browser URL.
server {
listen 8080;
location ^~ / {
# 如果需要的話
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:9000/microsevice/;
}
}
Displayed in the user’s browser URLlocalhost:9000/microsevice/demo
,實際訪問的是localhost:8080/demo/
.
server {
listen 9000;
location ^~ /microsevice/ {
# 如果需要的話
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8080/;
# 最后那個 / 是必須的。
}
}