nginx如何限制目录只允许某些IP段访
添加以下脚本即可:
location /restricted/ { # 允许特定IP段 allow 192.168.1.0/24; allow 10.1.1.0/16; # 拒绝所有其他IP deny all; # 其他配置… }
其中/restricted为目录名称,allow后为允许访问的IP段。
正文完
nginx如何限制目录只允许某些IP段访
添加以下脚本即可:
location /restricted/ { # 允许特定IP段 allow 192.168.1.0/24; allow 10.1.1.0/16; # 拒绝所有其他IP deny all; # 其他配置… }
其中/restricted为目录名称,allow后为允许访问的IP段。