1
我想使我的Tomcat7服務器的默認頁面是私人的,即只有在輸入密碼.htaccess
後方可使用。如何保護Tomcat的默認頁面?
我的意思是這個頁面:
爲此,我說:
<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對話框仍然不會出現。
我在做什麼錯?
請參見:[指定認證機制](http://docs.oracle.com/cd/E19226-01/820-7627/bncbn/index.html) – kenorb 2015-04-10 12:46:32