Java【tomcat】配置文件

2020-12-13 06:00

阅读:228

标签:定向   压缩   -name   注释   oca   tom   src   hint   它的   

本文原创地址在博客园:https://www.cnblogs.com/f-ck-need-u/p/8120008.html

 

Tomcat系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html


1. 入门示例:虚拟主机提供web服务

该示例通过设置虚拟主机来提供web服务,因为是入门示例,所以设置极其简单,只需修改$CATALINA_HOME/conf/server.xml文件为如下内容即可,本文的tomcat安装在/usr/local/tomcat下,因此$CATALINA_HOME=/usr/local/tomcat。其中大部分都采用了默认设置,只是在engine容器中添加了两个Host容器。

"1.0" encoding="UTF-8"?>
Server port="8005" shutdown="SHUTDOWN">
  Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  GlobalNamingResources>
    Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  GlobalNamingResources>
  Service name="Catalina">
    Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" enableLookups="false" />
    Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
   Engine name="Catalina" defaultHost="localhost">
     Realm className="org.apache.catalina.realm.LockOutRealm">
        Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase" />
      Realm>



Host name="www.longshuai.com" appBase="/www/longshuai" unpackWARs="true" autoDeploy="true"> Context path="" docBase="/www/longshuai" reloadable="true" /> Context path="/xuexi" docBase="xuexi" reloadable="true" /> Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="longshuai_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> Host>
Host name="www.xiaofang.com" appBase="webapps/xiaofang" unpackWARs="true" autoDeploy="true"> Context path="" docBase="" reloadable="true" /> Context path="/xuexi" docBase="xuexi" reloadable="true" /> Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="xiaofang_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> Host>
Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> Valve


评论


亲,登录后才可以留言!