톰켓설정 - 여러 포트로 서비스 하기

server.xml 을 아래와 같이 수정하면 서로 다른 서비스를 포트만 바꿔서 제공할 수 있다

 

 

 

<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>
 
  <Service name="Catalina">
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true"
               URIEncoding="KSC5601"/>
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />
    <Engine name="Catalina" defaultHost="localhost" debug="0">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>
      <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        <Logger className="org.apache.catalina.logger.FileLogger"
                directory="logs"
                prefix="localhost_log."
                suffix=".txt"
                timestamp="true"
                />

      </Host>

    </Engine>

  </Service>
 
  <!-- pay.csc.go.kr -->
  <Service name="Catalina4">
    <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8084" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" URIEncoding="KSC5601">
    </Connector>
    <Connector port="8014" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina4">
      <Host appBase="webapps4" name="localhost">
        <Valve className="org.apache.catalina.valves.AccessLogValve"
               directory="logs"
               prefix="localhost_payportal_access_log."
               suffix=".txt"
               pattern="%t [%a] [%l] [%m] [%U] [%H] [%q] [%s] [%b] [%{User-Agent}i] [%{Referer}i]"
               resolveHosts="false"
               />
        <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_payportal_log." suffix=".txt" timestamp="true"/>
      </Host>
      <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_payportal_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
  </Service>
 
</Server>

신고