我想授予对托管网站(nginx)的公共访问权限,并排除访问它的特定IP地址范围(123.456)。
简单地说:IP-Range 123.456的每次访问都应该通过Promname for Username / Password来限制。这就是我想要的东西。
这是我的.htaccess。
AuthType Basic
AuthName "Go away!"
AuthUserFile /home/www/path-to-my/.htpasswd
Require valid-user
Order Allow,Deny
Allow from all
Deny from 123.456
Satisfy any
我使用它时得到的结果:
答案 0 :(得分:0)
据我所知.htaccess文件仅适用于apache web服务器而非nginx。
您需要使用a converter转换规则或自行完成。
在你的情况下:
# nginx configuration
auth_basic "Go away!";
auth_basic_user_file /home/www/path-to-my/.htpasswd;
deny 123.456;
satisfy any;
配置指令非常相似,但它们是不同的。