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

你可能感兴趣的:(php)