nginx 配置ip访问限制
2024-08-11
1,只允许指定的ip访问,禁止其他ip访问

  allow xxx.xx.x.x;
  allow xxx.xx.x.x;
  deny all;
 

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

   deny xx.xxx.xx.x;
   deny xx.xxx.xx.x;
   allow all;
说明:allow all可以不添加

 

3,可以使用子网掩码来指定一个ip地址段:

deny xx.xx.x.x/24;