Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save qzmer1104/40cf427d3e59d0bef9a4898fdc896f59 to your computer and use it in GitHub Desktop.

Select an option

Save qzmer1104/40cf427d3e59d0bef9a4898fdc896f59 to your computer and use it in GitHub Desktop.
tail -n 500000 /var/log/nginx/access.log |awk '{print $1,$12}' |grep -i -v -E "google|yahoo|baidu|msnbot|FeedSky|sogou" |awk '{print $1}'|sort|uniq -c|sort -rn |awk '{if($1>1000)print "deny "$2";"}' > /etc/nginx/conf.d/blockip.conf
tail -n 500000 /var/log/nginx/zujigo.com.access.log |awk '{print $1,$12}' |grep -i -v -E "google|yahoo|baidu|msnbot|FeedSky|sogou" |awk '{print $1}'|sort|uniq -c|sort -rn |awk '{if($1>1000)print "deny "$2";"}' > /etc/nginx/conf.d/blockip.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment