June 30, 2008
Apache - Basic Authentication
簡単に済ませたいとき、たまに使うBasic認証。「たまに」なのでいつも忘れる。
パスワードファイル作成。
パスワードファイル作成。
$ htpasswd -c /usr/local/www/data/myapp/config/.htpasswd username New password: [enter password] Re-type new password: [enter password] Adding password for user usernamehttp.confに設定を追加する。
<Directory "/usr/local/www/data/myapp/">
AuthType Basic
AuthName "Private Area"
AuthUserFile /usr/local/www/data/myapp/config/.htpasswd
Require valid-user
</Directory>