The http host header is sent by the user-agent ("browser") based on the
address requested in the URL.  This is how virtual hosts are differentiated.
Tomcat supports a <host> container for virtual host differentiation, just
like Apache does.  You do not need to change the workers at all.  Tomcat
sees the same host header that Apache does.  I.e., using Tamper Data and
FireFox, I see 

Host=www.chandlerfamily.org.uk

When I request your web site.  (Along with a photo of you, presumably, in a
tie & sunglasses ;-)  You might also want to send just "Apache" for the
server, rather then

Server=Apache/2.0.54 (Debian GNU/Linux) mod_auth_pgsql/2.0.2b1 DAV/2
SVN/1.1.4 mod_jk/1.2.14 mod_python/3.1.3 Python/2.3.5 PHP/4.3.10-16
mod_ssl/2.0.54 OpenSSL/0.9.7e mod-xslt/1.0.0rc1

As it is "more secure".  How to do this was recently discussed on this list.

So, you should have two virtual hosts (by name) in both server.xml and
httpd.conf.  Not sure how to solve the https problem -- never tried to
myself.

Hope this is helpful,
Tim

-----Original Message-----
From: Alan Chandler [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 14, 2006 3:09 PM
To: users@tomcat.apache.org
Subject: Re: Setting up a parallel test environment on the same machine as
main server


On Tuesday 14 February 2006 12:36, Tim Lucia wrote:
> 1. Moving the JkMount directive inside a <VirtualHost...> will make it 
> accesible from only that virtual host.  So, you must repeat common 
> ones, such as /jkmanager.  I put the mappings (JkMount(s)) right in 
> the virtual host definition(s) with no trouble at all.

Thanks - just what I needed confirmation on

>
> 2. The virtual host is determined by the http host header, not by the 
> connector host name.  This is true for both httpd and tomcat (and any 
> other web server.)

Not sure I understand what you are mean here by "http host header", isn't
that 
the name of the web site that I am accessing (ie as known by apache) rather 
than as known by a backend topcat



At the moment, I have apache, with two virtual host names of


home.chandlerfamily.org.uk (also known as www.chandlerfamily.org.uk) (ip 
address of my WAN)
money.home (ip address of 192.168.0.32)

based on ip addressing only (ie not named virtual hosts - because it also 
needs to support https where named virtual hosts are not supported)

which all end up using tomcat services for parts of the web site (urls as 
defined in JkMountFile).  It is all directed to a single tomcat host via a  
single worker.properties file with the following

worker.list=tomcat

worker.tomcat.type=ajp13
worker.tomcat.host=appserv.home
worker.tomcat.port=8009
worker.tomcat.connect_timeout=10

and a single host on the server.xml line defined as

appserv.home

This appserv.home (ip address 192.168.0.31) is certainly currently getting
all 
the traffic it should get from apache - but I don't see how that is related 
to the http host in the header.

BUT ...

Do you mean that if I had changed my workers thusly

worker.list=production,test

worker.production.host=prodserv.home
worker.test.host=testserv.home
... for the other parameters

but where both prodserv.home, and testserv.home had the SAME ip address (say

127.0.0.1 :-) )

AND i add an apache virtual host of test.home (ip address 192.168.0.39)

That I can differenciate them in the server.xml file by having an engine 
running of localhost, but with two hosts with names of prodserv.home and 
testserv.home respectively, and that provided the JkMountFile was then moved

into the correct apache virtual host context, then the same url could be 
mapped by one apache virtual host to worker production and the other apache 
virtual host could map to worker test.

I could then have different versions of the same app running on production
and 
test.



>
> You can always install Apache httpd + Tomcat on a second machine (or 
> on the same machine on a separate set of ports), if you are reluctant 
> to try it on you production host.
>
> HTH,
> Tim
>
>
> -----Original Message-----
> From: Alan Chandler [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 14, 2006 3:50 AM
> To: users@tomcat.apache.org
> Subject: Re: Setting up a parallel test environment on the same 
> machine as main server
>
>
> On Sunday 12 February 2006 17:07, Alan Chandler wrote:
> ...
>
> > Unless anyone here can suggest a better way, I would like to move 
> > the JkMountFile directive from global scope to virtual host scope 
> > and have two separate files urimap files so that I can map different 
> > things dependent on which virtual host.
> >
> > However, since this is a live site I don't want to just conduct the 
> > simple experiment to see if will work, so I am asking here if this 
> > is OK.
>
> Is there really nobody on this list who can answer this simple 
> question?
>
> ...
>
> > However, I don't fully understand the relationship between 
> > <service>, <engine> and <host> stanza's in the server.xml file, and 
> > until I do, I am reluctant to muck about with it and potentially 
> > screw the currently working arrangement.
>
> Specifically, there was some conversation here about it best that if 
> tomcat was running on the same box as the web server (which it is in 
> my case) that it would be best to make the connection between apache2 
> and tomcat be via localhost.  That being the case, how can I map the 
> SAME servlet name but from a different virtual host (albeit ip based) 
> on apache to DIFFERENT hosts on the same tomcat engine.

-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

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



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

Reply via email to