nginx deny 封IP


官方文檔地址: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
1
2
3
配置在server上下文

Context: server

server {

server_name test.example.com;

...

deny 1.1.1.1;

deny 2.0.0.0/8;

}
1
2
3
4
5
6
7
8
9
10
11
配置在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;

...

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM