Basic認証(目次) +

はじめに +

/var/www/html 配下にBasic認証を設定します。

環境 +

  • OS
    • CentOS 5.3
  • パッケージ
    • httpd-2.2.3-31.el5.centos.2

認証設定(htpasswd利用) +

httpd.confの設定 +

  • /etc/httpd/conf/httpd.conf」に以下を追加します。
    <Directory /var/www/html>
        AuthType Basic
        AuthName "Please Enter User/Password"
        AuthUserFile    "/etc/httpd/.htpasswd"
        Require valid-user
    </Directory>
・Directory
認証が必要なディレクトリを指定します。
・AuthType
基本認証の場合は「Basic」
・AuthName
認証の際、ダイアログに出力されるメッセージ
・AuthUserFile
パスワードファイル名
・Require
アクセス可能なユーザ。valid-userは登録された全てのユーザ。
  • 再起動
    # /etc/init.d/httpd restart

ユーザ登録 +

  • hogeユーザを登録します。
    # htpasswd -c /etc/httpd/.htpasswd hoge
・-c
パスワードファイルを新規に作成する
・-m
MD5で暗号化する
・-s
SHA1で暗号化する
・-D
ユーザを削除する
このエントリーをはてなブックマークに追加
Last-modified: 2010-06-05 (土) 12:30:43 (627d)   最終更新のRSS