apache で htaccess
ディレクトリのアクセス制限をしようとして、http.conf を変更したり、.htaccess を書いたりしたのだが、ブラウザが一向に認証のダイアログを表示してくれない。
httpd.conf -- : DocumentRoot "C:/hoge" : <Directory "C:/hoge/"> AllowOverride AuthConfig Limit Order allow,deny Allow from all </Directory> :
.htaccess -- AuthType Basic AuthName "Private Area" AuthUserFile "c:/htpasswd" <Limit GET POST> require valid-user </Limit>
ずいぶん悩んだ後で気がついた。
JkMount /hoge ajp13 JkMount /hoge/* ajp13
アクセス制限をかけたかったディレクトリは hoge の下にあったりする。こうやった場合って、ディレクトリの認証は tomcat に委ねられる?
で、tomcat の web.xml と tomcat-users.xml にそれなりのことを書いて再起動したけど、やっぱ認証ダイアログさえ表示してくんない。しくしく。
$CATALINA_HOME/conf/web.xml -- <web-app> : <security-constraint> <web-resource-collection> <web-resource-name>User Auth</web-resource-name> <url-pattern>/hoge/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>guest</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>User Auth</realm-name> </login-config> <security-role> <role-name>guest</role-name> </security-role> </web-app>
$CATALINA_HOME/conf/tomcat-users.xml -- tomcat-users> : <role rolename="guest"/> : <user username="guest" password="guest" roles="guest"/> </tomcat-users>
どこがまずいんだろう?おしえて>えらいひと