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.
localhost:8080/demo/
localhost:9000/microsevice/demo
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/; # 最后那个 / 是必须的。 } }
Yes, use proxy_pass
Maybe I misunderstood what you meant.
Display
localhost:8080/demo/
,实际访问的是localhost:9000/microsevice/demo
in the user’s browser URL.Displayed in the user’s browser URL
localhost:9000/microsevice/demo
,实际访问的是localhost:8080/demo/
.Yes, use proxy_pass