set $flag 0; if ($http_referer ~* "特征字") { set $flag ${flag},1; } if ($http_user_agent ~* "spider") { set $flag $flag,2; } if ($flag = "0,1,2") { return 403; }
nginx 的多条件复合情况下的屏蔽策略
回复
set $flag 0; if ($http_referer ~* "特征字") { set $flag ${flag},1; } if ($http_user_agent ~* "spider") { set $flag $flag,2; } if ($flag = "0,1,2") { return 403; }