apache - WWWサーバのBASIC認証設定(CentOS6)

BASIC認証のテスト設定をおこなったので記す。

確認環境
  • CentOS6.0

確認手順

テストディレクトリの作成

# mkdir /var/www/html/test
# cd /var/www/html/test

WWWサーバ用パスワードファイルの設定

# htpasswd -c .htpasswd hoo
New password:
Re-type new password:
Adding password for user hoo

WWWサーバ用アクセス制御ファイルの設定

# vi .htaccess
AutuType Basic
AuthName "Authentication required"
AuthUserFile /var/www/html/test/.htpasswd
Require valid-user

テストアクセス用のWebページの作成

# vi index.html
test

WWWサーバの設定変更と再起動

# vi
...
(328行目) AllowOveride None 書き換え→ AllowOveride All
...
# service httpd restart

以上

コメント