nginx的 代码: # set $flag 0; # if ($http_user_agent ~* "360Spider|Baiduspider|Baiduspider-render|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Bingbot|MSNBot|YisouSpider|Sosospider|Sogou spider|Sogou web spider|Bytespider"){ # set $flag "${flag}1"; # } # if ($http_user_agent !~* "mobile|nokia|sony|ericsson|mot|samsung|htc|sgh|lg|sharp|sie-|philips|panasonic|alcatel|lenovo|iphone|ipod|blackberry|meizu|android|netfront|symbian|ucweb|windowsce|palm|operamini|operamobi|openwave|nexusone|cldc|midp|wap") { # set $flag "${flag}2"; # } # if ($flag = "01") { # #return 503; # } # if ($flag = "02") { # return 503; # } 把# 去掉
标签:Ngginx,set,处理,spider,agent,flag,Google,UA From: https://www.cnblogs.com/pythonClub/p/17659699.html