톰켓에서 여러 도메인을 동시에 서비스하도록 설정하는 방법이다.

 

$CALTALINA_HOME/conf/server.xml 을 수정한다


<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
    <Environment
      name="simpleValue"
      type="java.lang.Integer"
      value="30"/>
    <Resource
      auth="Container"
      description="User database that can be updated and saved"
      name="UserDatabase"
      type="org.apache.catalina.UserDatabase"
      pathname="conf/tomcat-users.xml"
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
  </GlobalNamingResources>
  <Service
      name="Catalina">
    <Connector
        port="80"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150"
        maxHttpHeaderSize="8192">
    </Connector>
    <Connector
        port="8009"
        redirectPort="8443"
        protocol="AJP/1.3">
    </Connector>
    <Engine
        defaultHost="localhost"
        name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host
          appBase="D:/Home/domain.com/DEV"
          name="dev.domain.com">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="dev.domain.com_access_log."
          suffix=".txt"/>
      </Host>
      <Host
          appBase="webapps"
          name="localhost">
      </Host>
      <Host
          appBase="D:/Home/domain.com/SSO"
          name="sso.domain.com">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="sso.domain.com_access_log."
          suffix=".txt"/>
      </Host>
      <Host
          appBase="D:/Home/domain.com/WWW"
          name="www.domain.com">
        <Alias>domain.com</Alias>
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="www.domain.com_access_log."
          suffix=".txt"/>
      </Host>
      <Host
          appBase="D:/Home/domain.com/KAS"
          name="kas.domain.com">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="kas.domain.com_access_log."
          suffix=".txt"/>
      </Host>
      <Host
          appBase="D:/Home/domain.com/BLOG"
          name="blog.domain.com">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="blog.domain.com_access_log."
          suffix=".txt"/>
      </Host>
      <Host
          appBase="D:/Home/enprog.com/KKABI"
          name="kkabi.enprog.com">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          fileDateFormat="yyyy-MM-dd"
          pattern="%h %l %u %t &quot;%r&quot; %s %b &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot;"
          prefix="kkabi.enprog.com_access_log."
          suffix=".txt"/>
      </Host>
    </Engine>
  </Service>
</Server>

신고

+ Recent posts