Posts Tagged ‘Apache’

17th 2月
2009
written by tmiyai

というか、備忘録

1..htaccessの作成
基本認証をかけたいディレクトリに.htaccessを作成

$ vi .htaccess

Shell

AuthType Basic
AuthUserFile /home/hoge/.htpasswd
AuthGroupFile /dev/null
AuthName "Input ID and Password."
require valid-user

ちなみに、require valid-userは、全てのユーザに対して基本認証の機会を与える設定。
※そのため本当はもっと絞り込んだ方が良いのですが、省略。

2..htpasswdの作成
先ほどの.htaccessで指定したパスに.htpasswdファイルを作成

$ htpasswd -c /home/hoge/.htpasswd username1
New password: ******[Enter]
Re-type new password: ******[Enter]

Tags: