自动完tomcat点下图框中默认会报错,因为没有账号密码,尝试多次后会报401
我们需要修改conf/tomcat-users.xml文件即可,下载在登录时输入username当时配置的即可正常登录
[root@localhost tomcat]# cat conf/tomcat-users.xml <?xml version="1.0" encoding="UTF-8"?> <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="admin-gui"/> <role rolename="host-gui"/> <role rolename="manager-gui"/> <user username="admin" password="admin" roles="admin-gui,host-gui,manager-gui"/> </tomcat-users> #配置完成后需要重启 在执行./shutdown后一定要查看进程和端口在不在
tomcat8.5以后的版本默认只允许机访问,换需要修改webapps/manager/META-INF/context.xml
#将value class的行注释掉即可 [root@localhost tomcat]# cat webapps/manager/META-INF/context.xml <?xml version="1.0" encoding="UTF-8"?> <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>