upstream app01 { least_conn; server localhost:9001 weight=5; server localhost:9002; server localhost:9003 backup; } upstream app02 { ip_hash; server localhost:9004 weight=5; server localhost:9005; server localhost:9006 down; } server { listen [::]:80 default_server; listen 80 default_server; server_name _; location /app01 { proxy_pass http://app01; } location /app02 { proxy_pass http://app02; } } # server 01 server { listen [::]:9001; listen 9001; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 01"; } # server 02 server { listen [::]:9002; listen 9002; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 02"; } # server 03 server { listen [::]:9003; listen 9003; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 03"; } # server 04 server { listen [::]:9004; listen 9004; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 04"; } # server 05 server { listen [::]:9005; listen 9005; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 05"; } # server 06 server { listen [::]:9006; listen 9006; server_name _; add_header Content-Type "text/plain"; return 200 "hello world: server 06"; }