upstream xxxOrderServer{ server 127.0.0.1:9005 weight=100; server 127.0.0.1:9006 weight=100; }
server { listen 80; server_name xxx.com; add_header backendIP $upstream_addr; add_header backendCode $upstream_status;
location ^~ /xxxOrder { proxy_pass http://xxxOrderServer/yyyy/zzzz; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_read_timeout 300; proxy_send_timeout 600; proxy_ignore_client_abort on; proxy_connect_timeout 300; proxy_next_upstream error; } }
如访问xxx.com/xxxOrder 则可能被转到127.0.0.1:9005/yyyy/zzzz这个路径。 注意,xxxOrder是不拼到转发的url里的。
|