Disclaimer: Don't take my word on what's provided below. It could be an
overkill or  incorrect. :-) But what the heck if I'm wrong someone will
correct me and we'll learn something in the process.

But I guess you could do it in two ways:
1) Have one tomcat instance, serving the two virtual hosts (one server.xml)
2) Have two tomcat instances running, each serving a virtual host (multiple
server.xml)

Common step) You would need to update the hosts file or the DNS server with
the two virtual host names.
As an example, let say we have two virtual hosts: "viking-dev.com" and
"viking-prod.com" with IP address: 192.168.146.82

To elaborate:
1) One Tomcat instance
------------------------------------
Steps:
a) Edit httpd.conf. Configure two virtual hosts.

NameVirtualHost 192.168.146.82
<VirtualHost 192.168.146.82>
    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot
D:/Apache-Tomcat-4.0/jakarta-tomcat-4.0.2/webapps/examplesdev
    ServerName viking-dev.com
    WebAppConnection conndev warp localhost:8008
    WebAppDeploy examplesdev conndev /examplesdev
    ErrorLog logs/viking.dev.com-error_log
    CustomLog logs/viking.dev.com-access_log common
</VirtualHost>
<VirtualHost 192.168.146.82>
    ServerAdmin [EMAIL PROTECTED]
    DocumentRoot
D:/Apache-Tomcat-4.0/jakarta-tomcat-4.0.2/webapps/examplesprod
    ServerName viking-prod.com
    WebAppConnection connprod warp localhost:8008
    WebAppDeploy examplesprod connprod /examplesprod
    ErrorLog logs/viking.prod.com-error_log
    CustomLog logs/viking.prod.com-access_log common
</VirtualHost>

b) Edit server.xml

<Host name="viking-dev.com" debug="0" appBase="webapps" unpackWARs="true">
<Context path="/examplesdev" docBase="examplesdev" debug="0" reloadable
="true" crossContext="false">
<Logger className="org.apache.catalina.logger.FileLogger" prefix
="localhost_examplesdev_log." suffix=".txt"          timestamp="true"/>
</Context>
</Host>
<Host name="viking-prod.com" debug="0" appBase="webapps" unpackWARs="true">
<Context path="/examplesprod" docBase="examplesprod" debug="0" reloadable
="true" crossContext="false">
<Logger className="org.apache.catalina.logger.FileLogger" prefix
="localhost_examplesprod_log." suffix=".txt"         timestamp="true"/>
</Context>
</Host>

I think that should do it. You can use the manager app to start, stop,
reload the contexts. Ofcourse you would need to deploy the manager webapp
in each virtual host defn. of the httpd.conf. And the same in the
<Host.../> element of server.xml. Also it would be a good idea to use two
entirely different DocumentRoots rather than the above (which fall under
webapps). And also modify the appBase attribute in each <Host.../> element
of server.xml appropriately once you do that. In the above I've use
mod_webapp as the connector. You could use mod_jk instead. I suppose it's
more stable than mod_webapp (see disclaimer again :-). Also remember to
turn off the standalone Http connector on port 8080.


2) Two tomcat instances (I haven't tried this. So I'm shooting in the dark
here :-)
-----------------------------------------------------------------------------------------------------------------
a) Edit httpd.conf as in (1) above
b) See the section on Advanced Configuration - Multiple Tomcat 4 instances
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/RUNNING.txt

Also a lot of this has been discussed in the archives. Check it out. And
also the documentation, your best source.
http://localhost:8080/tomcat-docs/index.html  -  tomcat documentation
and
http://localhost/manual/  -  apache documentation

RS







[EMAIL PROTECTED] on 03/11/2002 03:44:15 PM

Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>

To:   "Tomcat Users List" <[EMAIL PROTECTED]>
cc:

Subject:  virutal hosting with apache/tomcat

sorry for the multiple post and waste of bandwith...didn't want the subject
to throw folks off.
----- Forwarded by Jeffrey N Dyke/CORP/Keane on 03/11/2002 04:45 PM -----

                    Jeffrey_N_Dyke

                    @Keane.com           To:     "Tomcat Users List"
<[EMAIL PROTECTED]>
                                         cc:

                    03/11/2002           Subject:     Re: checksum errors

                    04:42 PM

                    Please respond

                    to "Tomcat

                    Users List"








Hello All.
     I have the need to run multiple virtual servers on a
Unix/Apache/Tomcat set up.  The server is sliced to have a development area
as well as a production area.  I would prefer only to have 1 instance of
Tomcat running(maybe 1 per slice).  Is this possible?  I have been reading
the documentation and mailing list archives, but the more info i get the
more confused i become....and yes i am fairly new to this.  If anyone has
set up this type of configuration, or attempted it, i'd love to hear about
it.  I am not against doing anything, even installing 1 tomcat per host,
but that doesn't seem to make sense.  I thought if there was a right
way...someone here has probably found it.

It is all the same server...just seperate named hosts and their respective
development environments.

Is this done in httpd.conf? server.xml?  Does anyone have any expierence
with this?  success rates?  suggesstions?

Thanks in advance for any and all assistance.
Jeff


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>









--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to