はじめに
Apache Digest認証を設定したところ、Apache Digest認証の認証画面が表示されない事象が起きたため、原因と対策を本記事に記載しました。
原因
Require all granted: このディレクティブは、全てのユーザーにアクセス権を与えるため、ダイジェスト認証の前にすべてのアクセスが許可されてしまいます。この行をコメントアウトすることでApache Digest認証の認証画面が表示されるようになりました。
vi /etc/httpd/conf/httpd.conf
130 # Further relax access to the default document root:
131 <Directory "/var/www/html">
132 AuthType Digest
133 AuthName "DigestAuth"
134 AuthUserFile "/etc/httpd/conf/.digestpass"
135 Require valid-user
136 #
137 # Possible values for the Options directive are "None", "All",
138 # or any combination of:
139 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
140 #
141 # Note that "MultiViews" must be named *explicitly* --- "Options All"
142 # doesn't give it to you.
143 #
144 # The Options directive is both complicated and important. Please see
145 # http://httpd.apache.org/docs/2.4/mod/core.html#options
146 # for more information.
147 #
148 Options Indexes FollowSymLinks
149
150 #
151 # AllowOverride controls what directives may be placed in .htaccess files.
152 # It can be "All", "None", or any combination of the keywords:
153 # Options FileInfo AuthConfig Limit
154 #
155 AllowOverride All
156
157 #
158 # Controls who can get stuff from this server.
159 #
160 # Require all granted ←この行の先頭にコメントアウト(#)を入れました。
161 </Directory>
apacheサービスを再起動する。
systemctl restart httpd
ブラウザでhttp://apacheサーバーのIPアドレスを入力する。
認証画面が出ました。