2016-01-21 56 views
0

我試圖在本地配置我的網站的基本身份驗證,但不適用於網站。Apache web服務器中的基本認證選項不起作用?

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"存在,並在/etc/httpd/conf/blacksocks-users位置的網站的HTML頁面都存在。一切都很好,但在訪問網站不要求任何authorization

回答

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> 

它的工作,但顯示的主頁

後,詢問用戶名和密碼