根据条件绑定hosts

@echo off
 CLS
 ECHO.
 :init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
 :checkPrivileges
 NET FILE 1>NUL 2>NUL
 if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
 ECHO.
 ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 ECHO args = "ELEV " >> "%vbsGetPrivileges%"
 ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
 ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 ECHO Next >> "%vbsGetPrivileges%"
 ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B
 :gotPrivileges
 setlocal & pushd .
 cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)

color 1A
 :firstinput
 echo  echo 请输入需要修复的平台名称的拼音       * echo 
 echo 例如平台名称为"百度",则输入"baidu"  *
 echo **
 set /p product=请输入拼音,并按确定键:
 if "%product%"=="longba" ( goto longbachange ) else ( if "%product%"=="qianying" ( goto qianyingchange ) else ( goto errorinput ))

:longbachange
 set /p domain=请输入要修复的"%product%"的域名,并按确定键:
 find /i "%domain%" C:\Windows\System32\drivers\etc\hosts>nul
 if "%errorlevel%"=="0" goto longbaview
 if "%errorlevel%"=="1" goto longbarepair2

:longbaview
 echo  echo 您已修复过此域名,是否重新修复       * echo ***
 echo 重新修复请输入“y”,退出请输入"n"或直接关闭程序 *
 echo ***
 set /p value=请输入:
 if "%value%"=="y" goto longbarepair1
 if "%value%"=="n" goto allexit

:longbarepair1
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 find /v "%domain%" hosts.new
 move hosts.new hosts>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:longbarepair2
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:qianyingchange
 set /p domain=请输入要修复的"%product%"的域名,并按确定键:
 find /i "%domain%" C:\Windows\System32\drivers\etc\hosts>nul
 if "%errorlevel%"=="0" goto qianyingview
 if "%errorlevel%"=="1" goto qianyingrepair2

:qianyingview
 echo  echo 您已修复过此域名,是否重新修复       * echo ***
 echo 重新修复请输入“y”,退出请输入"n"或直接关闭程序 *
 echo ***
 set /p value=请输入:
 if "%value%"=="y" goto qianyingrepair1
 if "%value%"=="n" goto allexit

:qianyingrepair1
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 find /v "%domain%" hosts.new
 move hosts.new hosts>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:qianyingrepair2
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:allexit
 echo 
 echo 您已终止修复程序,按任意键退出! *
 echo 
 pause
 exit

:errorinput
 echo *
 echo 您输入的平台名称有误!                  *
 echo *
 echo 请联系平台客服人员确认正确名称          *
 echo 
 echo 按确定键重新输入,退出请输入"n"或直接关闭程序    *
 echo 
 set /p what=请输入:
 if "%what%"=="n" goto allexit
 pause
 goto firstinput

Nginx gfw.conf

允许指定浏览器访问
if ($http_user_agent !~ "^((.UCWEB.)|(.WAP.)|(.Mini.)|(.iPhone.)|(.Android.)|(.Chrome.)|(.Safari.)|(.MSIE.)|(.Firefox.)|(.mobile.)|(java.)|(.BlackBerry.*))$" ){
             return 403;
 }

禁止各类蜘蛛
if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") { 
             return 403; 
 }

禁止Scrapy等工具的抓取
if ($http_user_agent ~* (Scrapy|Curl|HttpClient)) {
             return 403;
 }

禁止指定UA及UA为空的访问
if ($http_user_agent ~ "WinHttp|WebZIP|FetchURL|node-superagent|java/|FeedDemon|Jullo|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|Java|Feedly|Apache-HttpAsyncClient|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|BOT/0.1|YandexBot|FlightDeckReports|Linguee Bot|^$" ) {
             return 403;             
 }

禁止非GET|HEAD|POST方式的抓取
if ($request_method !~ ^(GET|HEAD|POST)$) {
             return 403;
 }

Centos7 Nginx nginx.conf

user www www;
worker_processes auto;

error_log /home/data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;

events {
    use epoll;
    worker_connections 51200;
    multi_accept on;
    }

http {
    include mime.types;
    default_type application/octet-stream;
    large_client_header_buffers 4 32k;
    client_max_body_size 1024m;
    client_body_buffer_size 10m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 120;
    server_tokens off;
    tcp_nodelay on;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;

    proxy_connect_timeout 600;
    proxy_send_timeout   600;
    proxy_read_timeout   600;
    proxy_buffer_size 32k;
    proxy_buffers 64 32k;
    proxy_busy_buffers_size 1m;
    proxy_temp_file_write_size 512k;
    send_timeout 600s;

    #Gzip Compression
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 6;
    gzip_http_version 1.1;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
        text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
        text/javascript application/javascript application/x-javascript
        text/x-json application/json application/x-web-app-manifest+json
        text/css text/plain text/x-component
        font/opentype application/x-font-ttf application/vnd.ms-fontobject
        image/x-icon;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

   log_format  main  '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" $remote_addr '
                      '$upstream_addr $upstream_response_time $request_time "$host" "$proxy_add_x_forwarded_for"';
    access_log off;

    server_names_hash_max_size 4096;
    server_names_hash_bucket_size 512;
    include vhost/include;
}

Proxy

upstream test {
server 127.0.0.1;
}

server {
          listen 80;
          #include Domain/test.txt;
          server_name test.com;
          location / {
                proxy_pass http://test;
                index index.jsp index.htm index.html;
                proxy_redirect off;
                proxy_set_header Host $host;
                proxy_headers_hash_max_size 51200;
                proxy_headers_hash_bucket_size 6400;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $http_x_forwarded_for;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header server_port $server_port;
              }
#access_log /home/wwwlogs/access.log;
}