Tomcat 8.5之后无法进入管理页面
2018-12-12 本文已影响0人
京樂春水
在使用Tomcat 8.5学习时,按照以往配置想进入管理页面,却出现如下问题:
You are not authorized to view this page.
By default the Host Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Host Manager's context.xml file.
/application/tomcat/webapps/host-manager/META-INF/context.xml
经过百度,找到如下解决方案,亲测可行:
编辑/application/tomcat/webapps/manager/META-INF/context.xml和/application/tomcat/webapps/host-manager/META-INF/context.xml(/application/tomcat是tomcat程序的目录)这两个文件,将其中的这一行注释掉
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
同时编辑 /application/tomcat/conf/tomcat-users.xml文件,设置用户名、密码
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
重启Tomcat即可。