我想将我的 Tomcat7 服务器的默认页面设为私有,即只有在.htaccess
输入密码后才能访问。
我的意思是这个页面:
为此,我补充说:
<user username="admin" password="admin" roles="manager-gui"/>
到tomcat-users.xml
.
然后我补充说:
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/references/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Application</realm-name>
</login-config>
<!-- Security roles referenced by this web application -->
<security-role>
<description>
The role that is required to log in to the Manager Application
</description>
<role-name>admin</role-name>
</security-role>
到webapps/ROOT/WEB-INF/web.xml
.
但是当我打开默认页面时,htaccess 对话框仍然没有出现。
我究竟做错了什么?