Nginx 的ngx_http_access_module 模块可以封配置内的ip或者ip段
deny IP;
deny subnet;
allow IP;
deny all;
allow all;
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
http {
deny 192.168.10.1;
include mime.types;
default_type application/octet-stream;
......
}
[root@localhost ~]# /usr/local/nginx/sbin/nginx -t
[root@localhost ~]# /usr/local/nginx/sbin/nginx -s reload
已无法正常访问 http://192.168.10.100/