server { listen 80; listen 443; server_name sudewz.com; access_log logs/sudewz.com.log main; #location /buyu { # root /opt/nginx/html/web-mobile/; # index index.html index.htm; #} location /longhu { #root /opt/nginx/html/web-mobile-old/; alias html/web-mobile-old/; #alias html/longhu/; index index.html index.htm; #expires 0; } location /xidadaisgood { alias html/web-mobile/; index index.html index.htm; } location / { #if ( $query_string ~* "gameId=118" ){ # rewrite ^/(.*)$ http://sudewz.com/buyu; # } if ( $query_string ~ gameId=108&channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/longhu; } if ( $query_string ~ gameId=128&channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/longhu; } #if ( $query_string ~* "gameId=138" ){ # rewrite ^/(.*)$ http://sudewz.com/longhu; #} if ( $query_string ~ gameId=188&channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/longhu; } if ( $query_string ~ gameId=186&channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/longhu; } # if ( $query_string ~* "gameId=198" ){ # rewrite ^/(.*)$ http://sudewz.com/longhu; # } if ( $query_string ~ gameId=195&channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/longhu; } #if ( $query_string ~* "gameId=199" ){ # rewrite ^/(.*)$ http://sudewz.com/longhu; #} #gameId=\d{3}&channelId=\d{5,}&machine_serial=[A-Za-z0-9]{30,}&token=.{1,} if ( $query_string ~ gameId=(.*)channelId=(.*)&machine_serial=(.*)&token=(.*) ){ rewrite ^/(.*)$ http://sudewz.com/xidadaisgood; } ### 上面的都没用那些具体到ID了,这个是所有gameid都转发 ### ### 所有带gameid的都转发去 http://sudewz.com/xidadaisgood ### #if ( $query_string ~ gameId=(.*)channelId=(.*)&machine_serial=(.*)&token=(.*) ){ # rewrite ^/(.*)$ http://sudewz.com/xidadaisgood; #} ### 所有带gameid的都转发去 http://sudewz.com/xidadaisgood ### root /opt/nginx/html; index index.html index.htm; } }