安装配置tomcat服务器,浏览器输入 localhost:8080,可正常访问主页,但访问localhost:8080/host-manager, localhost:8080/manager出现错误。
解决办法:
$ vim conf/tomcat-users.xml
#最后的内容修改为如下
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="yourname" password="yourpasswd" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
$ vim conf/Catalina/localhost/manager.xml
#添加如下内容
<Context privileged="true" antiResourceLocking="false"docBase="${catalina.home}/webapps/manager"><Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>
$ vim webapps/host-manager/META-INF/context.xml <Context antiResourceLocking="false" privileged="true" ><Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="\d+\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>