Tomcat管理配置
- 1 host-manager项目
- 2 manager项目
Tomcat 提供了Web版的管理控制台,位于webapps目录下。Tomcat 提供了用于管理Host的host-manager
和用于管理Web应用的manager
。
1 host-manager项目
Tomcat启动之后,可以通过 http://localhost:8080/host-manager/html 访问该Web应
用。 host-manager 默认添加了访问权限控制,当打开网址时,需要输入用户名和密码
(conf/tomcat-users.xml中配置) 。所以要想访问该页面,需要在conf/tomcatusers.
xml 中配置,并分配对应的角色:
1) admin-gui
:用于控制页面访问权限 allows access to the HTML GUI
;
2) admin-script
:用于控制以简单文本的形式进行访问 allows access to the text interface
;
配置如下:
<role rolename="admin-gui"/>
<role rolename="admin‐script"/>
<user username="feng" password="feng" roles="admin-gui,admin‐script"/>
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.
/opt/module/tomcat8.5.42/webapps/host-manager/META-INF/context.xml
<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" /> -->
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="\d+\.\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>
http://192.168.168.104:8080/host-manager/html
2 manager项目
配置如下:
<role rolename="admin-gui"/>
<role rolename="admin‐script"/>
<role rolename="manager-gui"/>
<role rolename="manager‐script"/>
<user username="chao" password="chao" roles="admin-gui,admin‐script,manager-gui,manager‐script"/>
/opt/module/tomcat8.5.42/webapps/manager/META-INF/context.xml
<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" /> -->
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="\d+\.\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>
http://192.168.168.104:8080/manager
Server Status