通过 Nginx 将爬虫和正常用户访问分开到不同的后端运行
1map $http_user_agent $is_bot {2????default 0;3????~[a-z]bot[^a-z] 1;4????~[sS]pider[^a-z] 1;5????'Yahoo! Slurp China' 1;6????'Mediapartners-Google' 1;7}1location @bots {2????proxy_pass http://osc_bot;3}1location / {2????error_page 418 =200 @bots;3????if ($is_bot) {4???????return 418;5????}6????proxy_pass http://osc_tomcats;7}