功能: 一个nginx代理转发,代理目标地址来自url中的host参数
location / {
  error_page 418 = @other;
  recursive_error_pages on;
  resolver 1.2.4.8;
  set $host '';
  if ($query_string ~ host=(http(s)?:\/\/[^\/]+(.com|.cn)(.*)$)){
     set $host $1;
  }
 set $args_tmp &${args};
 if ($args_tmp ~* ^(.*)(&host=[https:\/\/|\w%@\.]*)(.*)$){
    set $args $1$3;
  }
  #除去参数开头可能带有&字符的情况
 if ($args ~* ^&(.*)$){
     set $args $1;
  }
  if ($host != ''){
     # rewrite ".*" ${host}/?${args}? break;
     proxy_pass ${host}/?$args;
     #return 200 "${args}、${tag}";
  }
  if ($host = ''){
     return 418; 
  }
}  
location @other {
   # 这里是TP的伪静态
   try_files $uri $uri/ /index.php$is_args$query_string;  
}
 
  
  
  
 