url:?ID=91be4706799c57a785ce74a11761e5db&PD=81222E0&VMC=QQQQ&MAC=461f28e27d5d612599cf6a870ff5e4a7
要求根据参数的VMC转发不同的地址
server { listen 9001 ssl; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; server_name xxxx; location / { if ( $query_string ~* .*&VMC=(33333|77777)&.* ) { proxy_pass http://127.0.0.1:8802; } proxy_pass http://127.0.0.1:8801; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; #proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
$query_string在nginx里代表参数
~* 代表后面是不分大小写的正则表达式
.*&VMC=(33333|77777)&.* 匹配url后面参数的正则表达式,根据vmc的不同跳转,等于33333或者77777的url跳到8802端口。