nginx deny 封IP

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/fanren224/article/details/80503015

官方文档地址:http://nginx.org/en/docs/http/ngx_http_access_module.html#deny

Syntax: deny address | CIDR | unix: | all;
Default: 
Context:    http, server, location, limit_except

配置在server上下文

Context: server

server {

    server_name test.example.com;

    ...

   deny 1.1.1.1;

   deny 2.0.0.0/8;

}

配置在location上下文

Context: location

location ^~ /test/ {
    deny 1.1.1.1;
    deny 2.2.2.2;
    deny 3.3.3.3;
    deny 8.0.0.0/8;

    ...

}
展开阅读全文

没有更多推荐了,返回首页