Home  >  Q&A  >  body text

nginx ban ip problem

May I ask all the experts, can nginx directly ban an IP for a period of time? The module ngx_http_limit_req_module seems to only be able to limit the frequency but cannot ban the IP for a period of time.

I didn’t know the IP before. This IP list is dynamic and cannot be written into the configuration file in advance):

怪我咯怪我咯2734 days ago691

reply all(2)I'll reply

  • 为情所困

    为情所困2017-05-16 17:29:58

    Reference here:
    Nginx Block And Deny IP Address OR Network Subnets

    If you want to dynamically modify this IP list, you only need to write a program to update the IP list file regularly.
    After updating, check whether the configuration file is correct and reload nginx.

    There is also a lua implementation method:
    http://stackoverflow.com/questions/13917866/nginx-ip-whitelist

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:29:58

    deny 10.9.0.0/16;

    reply
    0
  • Cancelreply