Phillip Rhodes post the following instruction which is working prefectly
for me...

check it out...


POST from Phillip Rhodes:

This kind of got long and detailed.   I would like it to be reused if
possible in the faq.

I did it.  I have 3 virtual hosts in Apache, with 3 different instances of
Tomcat.  One for each virtual host.

I am running apache 1.3.9 on FreeBSD, jdk1.2.2, tomcat 3.2.1

create a subdirectory in /usr/local/jakarta-tomcat-3.2.1 for each apache
virtual host you want to run a tomcat instance for.  You can call them
tomcat1, tomcat2, and tomcat3

copy /usr/local/jakarta-tomcat-3.2.1/conf into each of your new
subdirectories.
The following commands are just used to clarify the above step....I know
you
know this!
cd /usr/local/jakarta-tomcat-3.2.1/
cp -R conf ./tomcat1
cp -R conf ./tomcat2
cp -R conf ./tomcat3
So now there is a ./tomcat1/conf, ./tomcat2/conf and a ./tomcat3/conf

You need to edit each server.xml in each of the conf directories that you
have just created.
Edit Steps:

1)
Find the ContextManage element and add the attribute "home", as shown
below.
This allows tomcat to create what it needs in each of the subdirectories
that you have created.
    <ContextManager home="tomcat1" debug="0" workDir="work"
showDebugInfo="true" >
When you edit the 2nd and 3rd server.xml files, just change tomcat1 to
tomcat2, and so on.

2)
Find the connector for HTTP.  This defaults to 8080 or something like that,
but in any case, it is a STUPID default, because you have default http,
ajp12 and ajp13 ports right next to each other.  I like to increment my
ports as I increment my instances.  Change the first server.xml file to use
an http port of "7001", the second one can be 7002, and so one.  (A brief
aside for the enlightened, my scheme is 7000's for HTTP, 8000's for ajp12
and 9000's for ajp13)

If you don't understand the above, don't worry, just find the line below
and
change the value to "7001" for you first server.xml, use 7002 for your
second server.xml, 7003 for your....and so on.

        <!-- Normal HTTP -->
        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"

value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
            <Parameter name="port"
                value="7001"/>
        </Connector>

3)
Find the connector for ajp12.  Change the port to 8001.  Use 8002, and so
on
for your other server.xml's
        <!-- Apache AJP12 support. This is also used to shut down tomcat.
          -->
        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"
       value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8001"/>
        </Connector>

4)
Add this line right after where the above line ends!  For subsequent
server.xml files, increment the port of 9001 to 9002....

        <!--    enable AJP13 support
          -->
        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
                <Parameter name="handler"
        value
="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
                <Parameter name="port" value="9001"/>
        </Connector>

5)  Add the following right after the line above.  Change the name
attribute
of element host. This value will be the virtual host as it is known to
apache. Change docbase to point to your web server document root!

<Host name="www.rhoderunner.com">
  <Context path="/" docBase="/usr/local/www/rhoderunner" debug="0"/>
</Host>

You are now done with server.xml file editing.

6)
Now edit the /usr/local/jakarta-tomcat-3.2.1/conf /workers.properties file.
You should read the HOWTO on this, but just follow the pattern that I have
done:  You can see my file at
http://www.rhoderunner.com/tomcatconf/workers.properties

Make sure your JAVA_HOME, PS environment variable are set correctly.
You want to create a 2 workers for every virtual host.  One worker will be
of type ajp12, and the other will be ajp13
I used a portion of the domain appended to the type of worker to name it.
This makes it much easier when you are setting up your apache conf file.
For example, here is my def for "ajp13rhoderunner".  Notice that I use port
9001 for the ajp13.  Remember the schema I defined earlier?  We use 9000
for
ajp3, and 8000 for ajp2

#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13rhoderunner.port=9001
worker.ajp13rhoderunner.host=localhost
worker.ajp13rhoderunner.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
#  ----> lbfactor must be > 0
#  ----> Low lbfactor means less work done by the worker.
worker.ajp13rhoderunner.lbfactor=1


Edit your apache httpd.conf file  Here is how I defined 2 virtual hosts:
# Load mod_jk
#
LoadModule    jk_module  libexec/apache/mod_jk.so
AddModule     mod_jk.c


# Configure mod_jk
#
JkWorkersFile /usr/local/jakarta-tomcat-3.2.1/conf/workers.properties
JkLogFile     /usr/local/etc/apache/mod_jk.log
JkLogLevel    error


<VirtualHost 216.55.177.74>
DocumentRoot /usr/local/www/rhoderunner
ServerName www.rhoderunner.com
JkMount /*.jsp ajp13rhoderunner
JkMount /servlet/* ajp13rhoderunner
</VirtualHost>
<VirtualHost 216.55.177.27>
DocumentRoot /usr/local/www/klaver4.com
ServerName www.klaver4.com
JkMount /*.jsp ajp13klaver4
JkMount /servlet/* ajp13klaver4
</VirtualHost>



Start apache and tomcat

JAVA_HOME=/usr/local/jdk1.2.2
bin/tomcat.sh start -f tomcat1/conf/server.xml
bin/tomcat.sh start -f tomcat2/conf/server.xml
bin/tomcat.sh start -f tomcat3/conf/server.xml











----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 04, 2001 8:02 PM
Subject: Howto: mod_jk + tomcat 3.2.1 + apache 1.3.14 + virtual host


> I can successfully create two virtual hosts ( mod_jk + tomcat 3.2.1 +
> apache 1.3.14 ) with ONE instance of tomcat.  I would like to be able to
> let the tow virtual hosts' owner to start their instance of tomcat.  In
> that case, tomcat's instance will own by them instead of NOBODY.....
>
> the currently HOWTO only tell us how to setup two virtual hosts with one
> tomcat instance using mod_jk. ( I know there are lot of document tell you
> how to do this with mod_jserv..... )
>
> If anyone has successfully doing this, can you post your configuration.
I
> pretty sure a lot of people will need that too..
>
>
> thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



                                                                                       
                      
                    박영훈                                                          
                         
                    <wegaia@hooll        To:     <[EMAIL PROTECTED]>      
                      
                    a.com>               cc:                                           
                      
                                         Subject:     i'm in trouble with configuring 
virtual hosting of     
                    01/05/2001           tomcat 3.2                                    
                      
                    09:44 PM                                                           
                      
                    Please                                                             
                      
                    respond to                                                         
                      
                    tomcat-user                                                        
                      
                                                                                       
                      
                                                                                       
                      





i'm running two site with defferent domain names
so i set up tomcat with virtual hosting function
one site is good(servlet, jsp both ok)
but the only servlet works at the ohter site
when i request .jsp files by my browser
the server didn't respond
how can i solve it?
two sites have the nearly same configuration..
thanks..


Reply via email to