tengine 黑白名单

http {

...

geo $whiteiplist {
  default 1;
  include limit/whiteip.conf;
}

map $whiteiplist $limit {
  1 $binary_remote_addr;
  0 "";
}
limit_conn_zone $limit zone=myzone_bbs:10m;
limit_req_zone $limit zone=one:10m rate=15r/s

...

}

location / {

...

limit_conn myzone_bbs 20;
limit_req zone=one burst=15 nodelay;

...

}

vi limit/whiteip.conf

58.xx.xx.xx 0;    #允许

210.xx.xx.xx 1;   #拒绝

原文地址:https://www.cnblogs.com/zenghui940/p/4738957.html