「新しいブラウザしか使えない」と言われていましたが、もういいだろ、ということで、
Basic 認証ではなく Digest 認証を導入することに。
(『もういいだろ』はもちろん、サービスのユーザー層によるので一概にいえない)
1) パスワードファイルを作る
# htdigest -c /etc/apache2/.htdigest "Digest Auth" kanrisha
2) *.conf
に設定を書く
my-site.conf
に設定を追記していくのだが、
<Directory /path/to/dir></Directory>
ディレクティブ内に書いても効かなかった。
mod_auth_digest - Apache HTTP Server Version 2.4
を見ると <Location /path/to/dir></Location>
ディレクティブ内に書いている。
これの真似をして、こんな感じに書いた。
<VirtualHost 111.111.111.111:80> ServerName some.where.jp DocumentRoot /home/some/web/ ErrorLog ${APACHE_LOG_DIR}/some.where.jp-error.log CustomLog ${APACHE_LOG_DIR}/some.where.jp-access.log combined <Location /> AuthType Digest AuthName "Digest Auth" AuthUserFile "/etc/apache2/.htdigest" Require valid-user </Location> <Directory /home/some/web/> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
あともしうまく動かなかったらファイルのパーミッションやオーナーも確認する感じで。