Operation and maintenance - Can nginx configure paths outside of IP and port?
我想大声告诉你
我想大声告诉你 2017-05-16 17:18:37
0
2
436

For example, my program is localhost:8080/demo/

Matched to: localhost:9000/microsevice/demo, one more microsevice service name

我想大声告诉你
我想大声告诉你

reply all(2)
我想大声告诉你

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/;
       # 最后那个 / 是必须的。
   } 
}
phpcn_u1582

Yes, use proxy_pass

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template