tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gur...@resolution.com
Subject Three hostnames in one instance of tomcat
Date Wed, 13 Sep 2006 23:03:51 GMT
I want to configure Tomcat so that I can have three hostnames live
on the same physical machine, but each have their own separate areas.
with one instance of Tomcat?

Users would hit URL's such as:

http://host1/
http://host2/
http://host3/

where each host should have its own webapps directory on the machine.
For example,

host1 --> /tomcat5/access/WEB-INF
host2 --> /tomcat5/ihl/WEB-INF
host3 --> /tomcat5/ulc/WEB-INF

I've tried several things including the addition of a three <Host>
directive underneath <Engine> but I can't seem to make it work. I
would appreciate a tip or a sample configuration file.

I've searched the web a bit and there seem to be several references to
having Apache (HTTP Server) in front of Tomcat. However, I don't
need/want a separate HTTP Server for now.

my server.xml
--------------------------------------------------
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <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"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
    <Connector port="8009" 
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <Engine name="Standalone" defaultHost="access1.resolution.com" debug="0"
jvmRoute="jvm1">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true">
                <Context path="" docBase="ROOT" debug="0"/>
      </Host>

      <Host name="access1.resolution.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

	<Realm className="org.apache.catalina.realm.JDBCRealm" debug="0"
                driverName="com.edb.Driver"                 
                connectionURL="jdbc:edb://baba1:9999/development"
		connectionName="test"
		connectionPassword="test"
                userTable="dbuser"
                userNameCol="username"
                userCredCol="password"
                userRoleTable="user_classes"
                roleNameCol="classDescription" 
        />

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="access1_log." suffix=".txt" debug="99"
                timestamp="true"/>

        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true"
                 notifyListenersOnReplication="true">

            <Membership 
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastPort="45564"
                mcastFrequency="500"
                mcastDropTime="3000"/>
            
            <Receiver 
                className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="access1"
                tcpListenPort="4001"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>

            <Sender
                className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"
                ackTimeout="15000"
                waitForAck="true"/>

            <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
                  
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                   
            <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                      tempDir="/tmp/war-temp/"
                      deployDir="/tmp/war-deploy/"
                      watchDir="/tmp/war-listen/"
                      watchEnabled="false"/>
                      
            <ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
        </Cluster>
        
        <Context    path="/access" 
                    docBase="/web/sites/dbAccess" 
                    debug="0" 
                    reloadable="true">
        
        <Logger     className="org.apache.catalina.logger.FileLogger"
                    prefix="access_log." suffix=".txt" debug="99"
                    timestamp="true"/>
                                  
        <Resource   name="jdbc/ifx"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/development"
                    validationQuery="SELECT dbuser.id FROM dbuser WHERE id = 1"
                    maxActive="20"
                    maxIdle="20"
                    maxWait="10000"/>
               
        <Resource   name="jdbc/workflow"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/workflowdb"
                    maxActive="0"
                    maxIdle="20"
                    maxWait="10000"/>

        <Resource   name="jdbc/azure"
                    auth="Container"
                    type="javax.sql.DataSource"                    
                    username="test"
                    password="test"                    
                    driverClassName="org.objectweb.cjdbc.driver.Driver"        
           
                    url="jdbc:edb://baba1:9999/azure"
                    maxActive="0"
                    maxIdle="20"
                    maxWait="10000"/>        
        </Context>
        
      </Host>
      
      
      <Host name="ihl1.resolution.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

       
	<Realm className="org.apache.catalina.realm.JDBCRealm" debug="0"
                driverName="com.edb.Driver"                 
                connectionURL="jdbc:edb://baba1:9999/development"
		connectionName="test"
		connectionPassword="test"
                userTable="dbuser"
                userNameCol="username"
                userCredCol="password"
                userRoleTable="user_classes"
                roleNameCol="classDescription" 
        />
        

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="ihl1_log." suffix=".txt" debug="99"
                timestamp="true"/>
        
        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true"
                 notifyListenersOnReplication="true">

            <Membership 
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastPort="45564"
                mcastFrequency="500"
                mcastDropTime="3000"/>
            
            <Receiver 
                className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="ihl1"
                tcpListenPort="4001"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>

            <Sender
                className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"
                ackTimeout="15000"
                waitForAck="true"/>

            <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
                  
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                   
            <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                      tempDir="/tmp/war-temp/"
                      deployDir="/tmp/war-deploy/"
                      watchDir="/tmp/war-listen/"
                      watchEnabled="false"/>
                      
            <ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
        </Cluster>
                
        
        <Context    path="/ihl" 
                    docBase="/web/sites/ihl" 
                    debug="0" 
                    reloadable="true">
        
        <Logger     className="org.apache.catalina.logger.FileLogger"
                    prefix="ihl_log." suffix=".txt" debug="99"
                    timestamp="true"/>
                                  
        <Resource   name="jdbc/ifx"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/development"
                    validationQuery="SELECT dbuser.id FROM dbuser WHERE id = 1"
                    maxActive="20"
                    maxIdle="20"
                    maxWait="10000"/>
               
        <Resource   name="jdbc/pgsql"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/workflowdb"
                    maxActive="2"
                    maxIdle="2"
                    maxWait="10000"/>        
        </Context>
	
      </Host>
      
      
      <Host name="ulc1.resolution.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

	<Realm className="org.apache.catalina.realm.JDBCRealm" debug="0"
                driverName="com.edb.Driver"                 
                connectionURL="jdbc:edb://baba1:9999/development"
		connectionName="test"
		connectionPassword="test"
                userTable="dbuser"
                userNameCol="username"
                userCredCol="password"
                userRoleTable="user_classes"
                roleNameCol="classDescription" 
        />

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="ulc1_log." suffix=".txt" debug="99"
                timestamp="true"/>
        
        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
                 managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true"
                 notifyListenersOnReplication="true">

            <Membership 
                className="org.apache.catalina.cluster.mcast.McastService"
                mcastAddr="228.0.0.4"
                mcastPort="45564"
                mcastFrequency="500"
                mcastDropTime="3000"/>
            
            <Receiver 
                className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="ulc1"
                tcpListenPort="4001"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"/>

            <Sender
                className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="pooled"
                ackTimeout="15000"
                waitForAck="true"/>

            <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
                  
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                   
            <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                      tempDir="/tmp/war-temp/"
                      deployDir="/tmp/war-deploy/"
                      watchDir="/tmp/war-listen/"
                      watchEnabled="false"/>
                      
            <ClusterListener
className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
        </Cluster>
        
                
        <Context    path="/ulc" 
                    docBase="/web/sites/ulc" 
                    debug="0" 
                    reloadable="true">
        
        <Logger     className="org.apache.catalina.logger.FileLogger"
                    prefix="ulc_log." suffix=".txt" debug="99"
                    timestamp="true"/>
                                  
        <Resource   name="jdbc/ifx"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/development"
                    validationQuery="SELECT dbuser.id FROM dbuser WHERE id = 1"
                    maxActive="20"
                    maxIdle="20"
                    maxWait="10000"/>
               
        <Resource   name="jdbc/pgsql"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="test"
                    password="test"
                    driverClassName="com.edb.Driver"
                    url="jdbc:edb://baba1:9999/workflowdb"
                    maxActive="2"
                    maxIdle="2"
                    maxWait="10000"/>        
        </Context>

      </Host>

    </Engine>

  </Service>

</Server>
--------------------------------------------------

-------------------------------------------------
This mail sent through IMP: www.resolution.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message