如下图修改nginx.conf文件的server块
server{ listen 80; server_name 172.0.0.1; location /a/{ proxy_pass http://172.0.0.2:8080 } location /b/{ proxy_pass http://172.0.0.3:8080 } }
监听的是80端口
访问172.0.0.1/a/就会跳转到http://172.0.0.2:8080;
访问172.0.0.1/b/就会跳转到http://172.0.0.3:8080