tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Venkata Srinivasa Rao, Yerra" <srini...@gipex.com>
Subject Re: Virtual host with Squid, Apache and Tomcat
Date Wed, 26 Nov 2003 07:12:46 GMT
Hi,

         As far as I know, we can do it in both workers2.properties and 
httpd.conf (virtual hosts). It seems some problem in apache side virtual 
host configuration for the same uri  for example

<VirtualHost ....>
         ServerName www.abc.com
         DocumentRoot ....
        <Location "/eng/*">
                 JkUriSet worker channel.socket:192.168.1.10:8008
                 JkUriSet vhost www.abc.com
                 JkUriSet context /eng
        </Location>
        <Location "/fre/*">
                 JkUriSet worker channel.socket:192.168.1.10:8009
                 JkUriSet vhost www.abc.com
                 JkUriSet context /fre
        </Location>
</VirtualHost>

<VirtualHost ....>
         ServerName www.xyz.com
         DocumentRoot ....
        <Location "/eng/*">
                 JkUriSet worker channel.socket:192.168.1.11:8008
                 JkUriSet vhost www.xyz.com
                 JkUriSet context /eng
        </Location>
        <Location "/fre/*">
                 JkUriSet worker channel.socket:192.168.1.11:8009
                 JkUriSet vhost www.xyz.com
                 JkUriSet context /fre
        </Location>
</VirtualHost>


[uri:www.xyz.com/eng/*]
info=eng web app
context=/
group=lb-gipalbum
debug=0
         www.abc.com virtual host pattern will be overwritten by 
www.xyz.com virtual host pattern. You can find it in jkstatus page. Always 
you will be redirected to 192.168.1.11 tomcats. Please let me know if you 
can find the solution.

To fix the above problem you can use workers2.properties as follows

[channel.socket:192.168.1.10:8008]
info=Ajp13 forwarding over socket to 10-8008 tomcat
tomcatId=abc_eng
lb_factor=1
debug=0

[channel.socket:192.168.1.10:8009]
info=Ajp13 forwarding over socket to 10-8009 tomcat
tomcatId=abc_fre
lb_factor=1
debug=0

[channel.socket:192.168.1.11:8008]
info=Ajp13 forwarding over socket to 11-8008 tomcat
tomcatId=xyz_eng
lb_factor=1
debug=0

[channel.socket:192.168.1.11:8009]
info=Ajp13 forwarding over socket to 11-8009 tomcat
tomcatId=xyz_fre
lb_factor=1
debug=0

[uri:www.abc.com/eng/*]
info=ABC Eng
context=/eng
group=abc_eng
debug=0

[uri:www.abc.com/fre/*]
info=ABC Fre
context=/eng
group=abc_fre
debug=0

[uri:www.xyz.com/eng/*]
info=XYZ Eng
context=/eng
group=xyz_eng
debug=0

[uri:www.xyz.com/fre/*]
info=XYZ Fre
context=/eng
group=xyz_fre
debug=0

At 04:25 PM 11/21/2003 +0100, you wrote:

>Hi
>
>I'm new to the list, so... hi!  :-)
>
>Here's our scenario: We use Squid as a reverse proxy cache in front of
>Apache which in return calls Tomcat for dynamic content:
>
>Browser  --> Squid  -->  Apache  -->  Tomcat
>
>Until now we used the old mod_webapp, but now we're changing to mod_jk2
>(with Apache 1.3 and Tomcat 4.1). We need to have several hosts on the same
>Apache and thus use virtual hosts. The problem is that the web applications
>sometimes need to have the same name.
>
>An example:
>
>www.abc.com has two web applications, one for each language (ISO codes):
>www.abc.com/eng/ and www.abc.com/fre/  (French)
>www.def.com also has two web applications which are different, but have the
>same name: www.def.com/eng/ and www.def.com/fre/
>
>Now, with the old mod_webapp, all we had to do is define a unique name for
>each of those (we chose a three-letter acronmy of the site plus the web
>application name), in this case "abc_eng", "abc_fre", "def_eng" and
>"def_fre" and point to them in the virtual host definition of Apache, like
>this:
><VirtualHost ....>
>         ServerName www.abc.com
>         DocumentRoot ....
>         WebAppDeploy  abc_eng /eng
>         WebAppDeploy  abc_fre /fre
></VirtualHost>
><VirtualHost ....>
>         ServerName www.def.com
>         DocumentRoot ....
>         WebAppDeploy  def_eng /eng
>         WebAppDeploy  def_fre /fre
></VirtualHost>
>
>As far as I can see, with mod_jk2, this is not possible in Apache alone. Am
>I right?
>
>I read on a couple of pages how Tomcat can be configured for virtual
>hosting, but I think these examples were all assuming that you use Tomcat as
>the web server. From what I understand I would need to define something like
>this in server.xml:
><Host name="www.abc.com" debug="0" appBase="webapps" unpackWARs="true">
>         <Context path="/eng" docBase="abc_eng" debug="0" reloadable="true"/>
>         <Context path="/fre" docBase="abc_fre" debug="0" reloadable="true"/>
></Host>
><Host name="www.def.com" debug="0" appBase="webapps" unpackWARs="true">
>         <Context path="/eng" docBase="def_eng" debug="0" reloadable="true"/>
>         <Context path="/fre" docBase="def_fre" debug="0" reloadable="true"/>
></Host>
>
>Another problem which may arise is that the domain names point to Squid,
>thus Apache only responds to the IP address. Frankly, I don't know exactly
>how Apache does the DNS lookup, and I know there's a parameter in the
>server.xml that enables DNS lookups. Surely, this is necessary for this
>scenario to work?
>
>Anyway, in a nutshell: Has anybody ever done this? Will this work?
>
>Any help is greatly appreciated!
>
>Thanks & best regards,
>Eric
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


----------
Best Regards,
Venkata Srinivasa Rao, Yerra
Gips Limited.
mail: srinivas@gipex.com
mobile: (852) 6191-5545
home: (852) 2807-2521
office: (852) 2104-5551
fax: (852) 2104-5550
web: http://www.gipalbum.com
web: http://www.gipex.com

----------


Mime
View raw message