2016.5.15 随笔————Tomcat 配置文件 server.xml

Tomcat 一般需要指向web应用的 Webroot

path 为访问路径

reloadable 重载 一般设置为false

source 资源目录  需要在servler中添加 zywSpringMVC

 

以下为 对一个 基本server.xml的说明

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 
 3 <Server port="8005" shutdown="SHUTDOWN">  
 4     <!-- 服务关闭端口号8005  关闭指令 SHUTDOWN -->
 5     
 6     <Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
 7     <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
 8     <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
 9     <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
10     <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
11 
12     <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -->
13     <GlobalNamingResources>
14         <!-- 定义了服务器 全局的JNDI资源   即命名和目录接口 -->
15         <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
16             <!-- Container代表应用sign on 到resource manager name  为资源名称 pathname 相对路径 type 为java类全称-->
17     </GlobalNamingResources>
18     <Service name="Catalina">
19         <!-- 服务 Catalina处理所有由Tomcat服务器接收的web客户请求 这个好像可以自定义 -->
20         
21         <Connector connectionTimeout="20000" port="8311" protocol="HTTP/1.1" redirectPort="8443"/>
22         <!-- 超时设置20s 服务器端口号 8309(通过8309发送服务器传输的数据) 协议http/1.1 当请求是https时 发送到8443端口 -->
23             
24         <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
25         <!-- 协议AJP/1.3   端口号为8009 定向包协议  -->
26 
27         <Engine defaultHost="localhost" name="Catalina">
28             <!-- Engine 元素处理在同一个Service 中所用Connector元素所接收到的客户请求 再传予相应主机
29                       默认为localhost  Engine name是  catalina  义-->
30 
31             <Realm className="org.apache.catalina.realm.LockOutRealm">
32             <!-- 这个Realm用数据库  主要是用来认证用户?  安全域?   -->
33                 <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
34             </Realm>
35 
36 
37             <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
38                 <!-- host 建立虚拟主机  appbase为应用程序 基本目录  名字为localhost  
39                 unpackWARs true 即为自动解压wars文件  提取应用程序 -->
40                 
41                 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>
42                 <!-- Valve元素相当于日志文件   
43                      calssname 为该使用类名   
44                      pattern可能是 符号转义值  不能再文本里显示的符号?-->
45 
46                 <Context docBase="Z:\MYjava\WebExercise\WebRoot" path="" reloadable="false"/>
47                 <!-- Context docBase设置应用程序路径 
48                      path为web应用程序url的前缀 形式是 http://localhost:8309/(path)  
49                      reloadable 为true则自动检测 WEB-INF/lib与WEB-INF/classes的目录变化 可在不重启 tomcat的情况下 改变应用程序-->
50             <Context docBase="E:\Tomcat 8\apache-tomcat-8.0.15-windows-x86\apache-tomcat-8.0.15\me-webapps\WebExercise" path="/WebExercise" reloadable="false" source="org.eclipse.jst.jee.server:WebExercise"/></Host>
51         </Engine>
52     </Service>
53 </Server>

 

posted @ 2016-05-15 22:08  zzfufuyy  阅读(155)  评论(0编辑  收藏  举报