$Id: htaccess.html,v 1.3 2002/12/12 05:52:55 hamano Exp $
Apacheでパスワード認証させる方法についてのメモ。
まず、パスワードを含むファイル(ここではusers)を作ります。 (下の********の部分は実際は何も表示されません。)
% htpasswd -c somewhere/etc/apache/users foo New password: ******** Re-type new password: ******** Adding password for user foo
次に、アクセス制御を行ないたいディレクトリに.htaccessファイルを置きます。
% cat > .htaccess << EOF AuthName "Foo" AuthType Basic AuthUserFile some-where/etc/apache/users require user foo EOF
これで出来上がり! うーん、簡単。
ひょっとしたらApache側の設定も必要かも。
% diff -u httpd.conf{.orig,}
--- httpd.conf.orig Tue Feb 26 21:02:58 2002
+++ httpd.conf Tue Feb 26 21:02:59 2002
@@ -398,7 +398,7 @@
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
- AllowOverride None
+ AllowOverride AuthConfig
#
# Controls who can get stuff from this server.
と、まぁ、こんな感じかな。