ロックされたサイト - 奇妙な動作

ロックされたサイト - 奇妙な動作

Centos7(httpd 2.4)でディレクトリロックまたはWebサイト全体のロックをテストすると、次のような奇妙な動作が見つかりました。

サイト全体をロックする場合:

 <VirtualHost *:80>
 DocumentRoot /www/vhost100
 ServerName vhost100.test.local
 ErrorLog "/var/log/httpd/vhost100_error_log.log"
 CustomLog "/var/log/httpd/vhost100_access_log.log" combined
 <Directory "/www/vhost100">
 Options Indexes
 Require all granted
 </Directory>
    <Directory "/www/vhost100">
        AuthType Basic
        AuthName "Protected Area"
        AuthUserfile /etc/httpd/authfile
       Require valid-user
    </Directory>
  </VirtualHost>

そして試してみてください:

 elinks http://vhost100.test.local 

authfileに従ってユーザー名/パスワードを送信すると、次のメッセージでログイン認証が失敗します。

 "This server could not verify that you are authorized to access the 
  document requested.Either you supplied the wrong credentials (eg bad 
  password) or your browser doesnt understand how to suppy the credentials 
  required"

エラーログファイルには何も記録されません。

逆に、仮想ホストを変更してサブディレクトリのロックを調整する場合(制限):

<VirtualHost *:80>
 DocumentRoot /www/vhost100
 ServerName vhost100.test.local
 ErrorLog "/var/log/httpd/vhost100_error_log.log"
 CustomLog "/var/log/httpd/vhost100_access_log.log" combined
 <Directory "/www/vhost100">
 Options Indexes
 Require all granted
 </Directory>
 <Directory "/www/vhost100/restricted">
      AuthType Basic
      AuthName "Protected Area"
      AuthUserfile /etc/httpd/authfile
      Require valid-user
 </Directory>
 </VirtualHost>

そして試してみてください:

elinks http://vhost100.test.local/restricted 

認証が機能し、保護されたコンテンツを見ることができます!どんなアイデアや助けでも大変感謝します。

ベストアンサー1

2つの競争的な<Directory "/www/vhost100">声明を避けなさい。

おすすめ記事