http { upstream product_server { 127.0.0.1: 8081; } upstream admin_server{ 127.0.0.1: 8082; } upstream test_server{ 127.0.0.1: 8083; } # 默认指向product的server server { location / { proxy_pass http://product_server; } location / product / { proxy_pass http://product_server; } location / admin / { proxy_pass http://admin_server; } location / test / { proxy_pass http://test_server; } } }