LoginSignup
6
4

More than 5 years have passed since last update.

Amazon Linux - ApacheにBASIC認証をかけてみる

Last updated at Posted at 2018-11-01

Amazon Linux に Apache 環境でBasic認証をかけてみた。


ここでは、ユーザー名:user1、パスワード:pass で認証設定をする。

htpasswd -c -b /etc/httpd/conf/.htpasswd user1 pass
スクリーンショット 2018-11-01 21.08.42.png

httpd.conf にBASIC認証の設定を追加する。
vi /etc/httpd/conf/httpd.conf

<Directory "/var/www/html/">
AuthUserFile /etc/httpd/conf/.htpasswd
AuthGroupFile /dev/null
AuthName "Basic Auth"
AuthType Basic
Require valid-user
</Directory>

スクリーンショット 2018-11-01 21.11.22.png
スクリーンショット 2018-11-01 21.10.50.png

Apacheを再起動する。
/etc/init.d/httpd restart

表示された!
スクリーンショット 2018-11-01 21.13.18.png

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4