NGINX Config Random Redirect / Nginx 301 多url 负载转向
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
user nginx; worker_processes 1; error_log /var/log/nginx/error.log; pid /run/nginx.pid; events { worker_connections 1024; } http { split_clients "${remote_addr}-{$query_string}" $goto { 50.0% "http://127.0.0.1:8081"; * "http://127.0.0.1:8082"; } server { listen 8080; return 301 $goto; } server { listen 8081; return 200 "server1\n"; } server { listen 8082; return 200 "server2\n"; } } |
测试 [crayon-674059bf1fc […]