TIPS/apache/パスワードアクセス制限設定

Last-modified: 2006-07-13 (木) 11:48:58

パスワード制限設定方法

httpd.conf

httpd.confに以下を登録

[AuthType Digestの場合]

<Directory パスワードを掛けたいディレクトリ>
       AuthType Digest
       AuthName NS-Library
       AuthDigestFile パスワードファイルをフルパスで指定
       require valid-user
</Directory>

[AuthType Basicの場合]

<Directory パスワードを掛けたいディレクトリ>
   AuthName Mailing_List
   AuthType Basic
   AuthUserFile パスワードファイルをフルパスで指定
   require valid-user
</Directory>

パスワードファイルの作り方

[AuthType Digestの場合]

htdigest [-c] <password-file> <realm> <user-name>

始めて作成する時には、-cが必要。
realmには、AuthName に指定した文字列を入れる。(上の例だと"NS-Library")

[AuthType Basicの場合]

htpasswd [-c] <password-file> <user-name>
例 htpasswd -c /etc/httpd/conf/passwd nstech

始めて作成する時には、-cが必要。