背景: 在配置jenkins集成持续构建,配置容器账号口令,
需要配置tomcat_user.xml
tomcat7&8打开配置文件conf/tomcat_user.xml文件
将如下行开关打开依旧无法访问
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
<user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
<user username="role1" password="<must-be-changed>" roles="role1"/>
-->
添加如下行重启即可
1
2
3
4
5
6
7
|
<role rolename= "manager" />
<role rolename= "manager" />
<role rolename= "manager-gui" />
<role rolename= "admin" />
<role rolename= "admin-gui" />
<role rolename= "manager-script" />
<user username= "tomcat" password= "tomcat" roles= "admin-gui,admin,manager-gui,manager,manager-script" />
|
其中admin-gui是为了能访问manger的界面,manager-secret是为了可以上传war文件
做完了以上的步骤,可以用localhost:8080/manager,或者127.0.0.1:8080/manager要远程访问manager的页面,但是换为IP:8080/manager被拒绝了
配置远程访问manager:
conf/Catalina/localhost/下 添加manager.xml
1
2
3
4
5
|
< /pre ><pre name= "code" class= "java" ><Context privileged= "true" antiResourceLocking= "false" < /pre ><pre name= "code" class= "java" ><Context privileged= "true" antiResourceLocking= "false" docBase= "${catalina.home}/webapps/manager" >
<Valve className= "org.apache.catalina.valves.RemoteAddrValve" allow= "^.*$" />
< /Context >
|
注:
-
manager-gui
-
允许访问html接口(即URL路径为/manager/html/*)
-
manager-script
-
允许访问纯文本接口(即URL路径为/manager/text/*)
-
manager-jmx
-
允许访问JMX代理接口(即URL路径为/manager/jmxproxy/*)
-
manager-status
-
允许访问Tomcat只读状态页面(即URL路径为/manager/status/*)