1. 确保tomcat下原来自带的几个项目未被删掉,tomcat启动时localhost:8080能直接访问tomcat主页
2. 修改tomcat下 conf/tomcat-users-xml文件,找到tomcat-users标签,按照下面的加上配置
注: username: 用户名, password:密码 自己根据需求做修改
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager,manager-gui"/>
</tomcat-users>
3. 修改 tomcat/webapps/manager/META-INF/context.xml,注释掉context标签下的所有代码,否则会出现无访问权限的问题
<Context antiResourceLocking="false" privileged="true" >
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
-->
</Context>
4. 登录tomcat首页,点击 Server Status 登录到管理界面