Nginx http_user_agent 防御 ab 等

4年前 (2015-12-14) Jason Liu 运维 0评论 已收录 181℃

日志出现大量:

xxxxxxxxxxxxx - - [04/Jul/2013:23:37:49 +0800] "GET /1000.html HTTP/1.0" 200 56471 "-" "ApacheBench/2.3" -

xxxxxxxxxxxxx - - [04/Jul/2013:23:37:49 +0800] "GET /1000.html HTTP/1.0" 200 56471 "-" "ApacheBench/2.3" -

Nginx 设置..Nginx.conf 添加

if ($http_user_agent ~ ApacheBench|WebBench|Jmeter|must-revalidate){

return 403;

}

重启~Nginx 以后~~再查看日志

xxxxxxxxxxxxxx - - [05/Aug/2013:08:33:18 +0800] "GET / HTTP/1.0" 403 168 "-" "ApacheBench/2.3" -

xxxxxxxxxxxxxx - - [05/Aug/2013:08:33:18 +0800] "GET / HTTP/1.0" 403 168 "-" "ApacheBench/2.3" -

相关推荐

嗨、骚年、快来消灭0回复。