Pet*_*mit 8 nginx password-protected
在我的 Nginx 设置中,我想用密码保护某个网站,除非我从家里的 ip 访问它。我该如何设置?
另外,除了可以访问我的家用电脑之外,这安全吗?
Pet*_*mit 13
经过长时间的搜索,我自己找到了。
当满足_any 被置于“指令通过至少一个成功检查解决访问,由模块 HttpAccessModule 或 HttpAuthBasicModule 执行”时
location / {
satisfy any;
allow 10.1.1.10;
deny all;
auth_basic "closed site";
auth_basic_user_file /data/www_data/htpasswd;
}
Run Code Online (Sandbox Code Playgroud)
(satisfy any是新语法,satisfy_any发出警告。但是我找不到文档)