版权声明:hanxinkong提供技术支持 https://blog.csdn.net/hanxinkong/article/details/86813529
一、基于Basic Auth认证
yum install -y httpd-tools
htpasswd -c /nginx/.htpasswd hxk
/nginx/conf/nginx.conf
在配置后面添加两行配置
server {
auth_basic "Restricted";
auth_basic_user_file /opt/nginx/.htpasswd;
}
二、基于IP的访问控制
189 location ~ ^/hidd/ {
190
191 allow 192.168.2.220;
192 root "/home/media";
193 deny all;
194
195 }