deny nginx频繁访问的IP

time=`date -d  "1 minutes ago" +%Y:%H:%M`;
echo $time;
ips=`grep $time /app/nginx/logs/u.7654.com.log | grep 200  | awk '{print $1}' | sort | uniq -c | awk '{if($1>100) print "deny "$2 ";"}'`;
echo $ips;
if [ -n "$ips" ];then
        echo $ips>>/app/nginx/conf/deny.conf;
        nginx -s reload
else
   echo "null";
fi

猜你喜欢

转载自blog.csdn.net/bestmover/article/details/80960245