我尝试在本地为我的网站配置基本身份验证。但不适用于网站。
我的httpd.conf
<VirtualHost 192.168.2.5:80>
DocumentRoot /var/www/html/black-socks
ServerName www.black-socks.com
<Directory "/var/www/html/black-socks">
Order deny,allow
Allow from all
AuthType Basic
AuthName BlackSocks-LOGIN
AuthUserFile "/etc/httpd/conf/blacksocks-users"
Require ValidUser
</Directory>
authuserfile
存在于/etc/httpd/conf/blacksocks-users"
,网站html页面存在于/etc/httpd/conf/blacksocks-users
位置。一切都很好但访问网站时没有询问任何authorization
答案 0 :(得分:0)
<VirtualHost 192.168.2.5:80>
DocumentRoot /var/www/html/black-socks
ServerName www.black-socks.com
<Directory "/var/www/html/black-socks">
Allow from ram
AuthType Basic
AuthName BlackSocks-LOGIN
AuthUserFile "/etc/httpd/conf/myusers"
Require ValidUser
</Directory>
它工作但在显示主页后询问用户名和密码