首页 > 技术文章 > tengine 黑白名单

zenghui940 2015-08-18 11:35 原文

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;   #拒绝

 

推荐阅读