apache Web服务器中的基本身份验证选项不起作用?

时间:2016-01-21 07:01:37

标签: apache http webserver httpd.conf

我尝试在本地为我的网站配置基本身份验证。但不适用于网站。

我的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

1 个答案:

答案 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>

它工作但在显示主页后询问用户名和密码