Tomcat(一)

1. 解压后的文件目录结构

  bin:存放启动和关闭Tomcat的路径

  conf:存放Tomcat的配置,所有的Tomcat的配置都在该路径下设置

  lib:存在Tomcat服务器的核心类库

  logs:保存Tomcat运行产生的日志

  temp:临时文件

  webapps:用于自动部署Web应用,将Web应用复制到该路径下,Tomcat会将该应用自动部署在容器中

  work:保存Web应用在运行过程中,编译生成的class文件。

2. 配置Tomcat的服务端口

  conf/server.xml文件

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

3. 控制台配置

  配置用户名和密码:webapps/manager/WEB-INF

<security-constraint>
    <web-resource-collection>
      <web-resource-name>HTML Manager interface (for humans)</web-resource-name>
      <url-pattern>/html/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-gui</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Text Manager interface (for scripts)</web-resource-name>
      <url-pattern>/text/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-script</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>JMX Proxy interface</web-resource-name>
      <url-pattern>/jmxproxy/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-jmx</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Status interface</web-resource-name>
      <url-pattern>/status/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
       <role-name>manager-gui</role-name>
       <role-name>manager-script</role-name>
       <role-name>manager-jmx</role-name>
       <role-name>manager-status</role-name>
    </auth-constraint>
  </security-constraint>

  通常需要访问匹配/html/*资源,所以是manager-gui。

  添加manager-gui类型用户:conf/tomcat-users.xml 

<tomcat-users>...</tomcat-users>

 

posted on 2018-10-26 10:38  岁月磨平青春的棱角  阅读(144)  评论(0)    收藏  举报

导航