如何保护Tomcat的默认页面?

如何保护Tomcat的默认页面?,tomcat,security-constraint,Tomcat,Security Constraint,我想将Tomcat7服务器的默认页面设置为私有,即。E只有在输入.htaccess密码后才能访问 我指的是这一页: 为此,我补充说: <user username="admin" password="admin" roles="manager-gui"/> 到webapps/ROOT/WEB-INF/WEB.xml 但是当我打开默认页面时,htaccess对话框仍然没有出现 我做错了什么?看看你的,它指向/references/*(根文件夹中不存在) 典型的Tomcat设置欢迎页

我想将Tomcat7服务器的默认页面设置为私有,即。E只有在输入
.htaccess
密码后才能访问

我指的是这一页:

为此,我补充说:

<user username="admin" password="admin" roles="manager-gui"/>
webapps/ROOT/WEB-INF/WEB.xml

但是当我打开默认页面时,htaccess对话框仍然没有出现

我做错了什么?

看看你的
,它指向
/references/*
(根文件夹中不存在) 典型的Tomcat设置欢迎页面位于根文件夹中,因此
应该指向
/*

请参见:
<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>