You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Gerstel, Rachel" <Ra...@commerzbankib.com> on 2002/09/10 16:53:14 UTC

Virtual Host Auto Config

Hi,

Sorry if this question has already been asked, but I have searched and not
yet found the answer I need.

I have an apache server 1.3.26 that I wish to integrate with tomcat and have
name-based virtual hosts on. I think I am getting confused between the
server itself and the virtual hosts. I am running tomcat 4.0.4 and when I
start up Tomcat everything seems ok, but when I start up apache I get the
following warning:
[Tue Sep 10 16:26:30 2002] [warn] VirtualHost
tre-mmc-pl.fra.ib.commerzbank.com:80 overlaps with VirtualHost cogapi01:80,
the first has precedence, perhaps you need a NameVirtualHost directive

This is the first time I have ever set-up tomcat so please excuse any
glaring newbie mistakes in my config.

Also, if anyone has input - how would I then set up the Apache side to serve
static files? If I am automatically generating the Virtual Hosts directives,
where I assume this information would need to be added then I am not sure
how to get this extra information in there and still use the auto-config
feature in tomcat.

Thanks in advance for any help,
Rachel

This is my server.xml:

Note - I have only have the one actual application right now so I used the
name of the server as the first virtual host and the examples for tomcat as
it's webapp:

<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
     parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
     which may contain one or more "Service" instances.  The Server
     listens for a shutdown command on the indicated port.

     Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" or "Loggers" at this level.
 -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

        <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
                                jkDebug="info"
modJk="/usr/local/apache/libexec/mod_jk.so" /> 

  <Service name="cogapi01-tomcat">


    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="8009" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>

    <Engine name="Standalone" defaultHost="localhost" debug="0">

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally
-->
      <Realm className="org.apache.catalina.realm.MemoryRealm" />


        <!-- First Virtual Host cogapi01 -->
        <Host name="cogapi01" address="10.144.14.71:80" debug="0"
appBase="webapps" unpackWARs="true">

        <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
                                 append="true" forwardAll="true"
noRoot="false" jkDebug="info" />
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                        directory="logs"  prefix="cogapi01_access."
suffix=".log"
                        pattern="common"/>

        <Logger className="org.apache.catalina.logger.FileLogger"
                        directory="logs"  prefix="cogapi01." suffix=".log"
                        timestamp="true"/>

        <!-- Tomcat Examples Context -->
        <Context path="/examples" docBase="examples" debug="0"
                 reloadable="true" crossContext="true">
          <Logger className="org.apache.catalina.logger.FileLogger"
                     prefix="cogapi01_examples." suffix=".log"
                  timestamp="true"/>
          <Ejb   name="ejb/EmplRecord" type="Entity"
                 home="com.wombat.empl.EmployeeRecordHome"
               remote="com.wombat.empl.EmployeeRecord"/>
          
                  <Environment name="maxExemptions" type="java.lang.Integer"
                      value="15"/>
          <Parameter name="context.param.name" value="context.param.value"
                     override="false"/>
          <Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
                    type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/EmployeeAppDb">
            <parameter><name>user</name><value>sa</value></parameter>
            <parameter><name>password</name><value></value></parameter>
            <parameter><name>driverClassName</name>
              <value>org.hsql.jdbcDriver</value></parameter>
            <parameter><name>driverName</name>
              <value>jdbc:HypersonicSQL:database</value></parameter>
          </ResourceParams>
          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/Session">
            <parameter>
              <name>mail.smtp.host</name>
              <value>localhost</value>
            </parameter>
          </ResourceParams>
        </Context>
      </Host>

      <!-- Define the second vhost tre --> 
      <Host name="tre-mmc-pl.fra.ib.commerzbank.com"
address="10.144.14.71:80" debug="0" appBase="webapps" unpackWARs="true">

        <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
                                 append="true" forwardAll="true"
noRoot="false" jkDebug="info" />
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="tre_access." suffix=".log"
                 pattern="common"/>

        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="tre." suffix=".log"
                timestamp="true"/>

        <!-- Cognotec/FORS mmc Context -->
        <Context path="/mmc" docBase="mmc" debug="0"/>
                <Logger className="org.apache.catalina.logger.FileLogger"
prefix="mmc_webapp." suffix=".log"/>

                <Context path="/tre" docBase="mmc/tre" debug="0"
privileged="true"/>

                <Context path="/css" docBase="mmc/css" debug="0"
privileged="true"/>

                <Context path="/js" docBase="mmc/js" debug="0"
privileged="true"/>

                <Context path="/images" docBase="mmc/images" debug="0"
privileged="true"/>
        </Host>
        </Engine>
</Service>
</Server>

Here is my auto apache file:
/usr/local/tomcat/conf/auto
########## Auto generated on Tue Sep 10 16:26:03 CEST 2002##########

<IfModule !mod_jk.c>
  LoadModule jk_module /usr/local/apache/libexec/mod_jk.so
</IfModule>

JkWorkersFile "/usr/local/jakarta-tomcat-4.0.4/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-4.0.4/logs/mod_jk.log"

JkLogLevel info

<VirtualHost tre-mmc-pl.fra.ib.commerzbank.com>
    ServerName tre-mmc-pl.fra.ib.commerzbank.com

    JkMount /tomcat-docs ajp13
    JkMount /tomcat-docs/* ajp13

    JkMount /images ajp13
    JkMount /images/* ajp13

    JkMount /mmc ajp13
    JkMount /mmc/* ajp13

    JkMount /css ajp13
    JkMount /css/* ajp13

    JkMount /js ajp13
    JkMount /js/* ajp13

    JkMount /webdav ajp13
    JkMount /webdav/* ajp13

    JkMount /examples ajp13
    JkMount /examples/* ajp13

    JkMount /manager ajp13
    JkMount /manager/* ajp13

    JkMount /tre ajp13
    JkMount /tre/* ajp13

    JkMount / ajp13
    JkMount /* ajp13
    DocumentRoot "/usr/local/jakarta-tomcat-4.0.4/webapps/ROOT"
</VirtualHost>

<VirtualHost cogapi01>
    ServerName cogapi01

    JkMount /mmc ajp13
    JkMount /mmc/* ajp13

    JkMount /examples ajp13
    JkMount /examples/* ajp13

    JkMount /webdav ajp13
    JkMount /webdav/* ajp13

    JkMount /tomcat-docs ajp13
    JkMount /tomcat-docs/* ajp13

    JkMount /manager ajp13
    JkMount /manager/* ajp13

    JkMount / ajp13
    JkMount /* ajp13
    DocumentRoot "/usr/local/jakarta-tomcat-4.0.4/webapps/ROOT"
</VirtualHost>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>