nginx配置

http {
2    # 其他全局配置...
3
4    server {
5        listen 80;
6        server_name example.com;
7
8        # 包含黑名单 IP
9        include /etc/nginx/blacklist.txt;
10
11        location / {
12            root /var/www/html;
13            index index.html;
14        }
15
16        # 其他服务器配置...
17    }
18}

allow/deny的应用例子

1,只允许指定的ip访问,禁止其他ip访问

  allow 43.243.12.116;
  allow 122.53.54.55;
  deny all;

 

2,只禁止指定的ip访问,其他ip都允许访问

   deny 43.243.12.116;
   deny 43.241.242.243;
   allow all;

说明:allow all可以不添加

下载nginx可用的文件

https://ip-15559.rivers.chaitin.cn/api/share/ip_group/xxxxxxxxxxxxxxxxxxxxxx?format=nginx_deny