You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Naren Koka <na...@indidge.com> on 2006/05/16 15:40:09 UTC

JK Connector not distinguishing between Virtual hosts

I am using mod_jk with Tomcat 5 and Apache 2.2. JK is directing to 
the default Host in Tomcat Server. It is not able to distinguish the 
sites. When we go to abc2.com, it shows half the content from 
abc1.com, which has a lot of files with the same name as abc2.com. Is 
this a known bug? Anybody has seen it?

Ealier, I was using WebApp connector for Name Based Virtual Hosting 
on my Apache server. Everything was working fine.  Here is the 
httpd.conf when using WebApp.

LoadModule webapp_module modules/mod_webapp.so
WebAppConnection        conn    warp    localhost:8008

NameVirtualHost 192.168.1.201

<VirtualHost 192.168.1.201>
     ServerName "www.abc.com:80"
     ServerAdmin "abc@abc.com"
     DocumentRoot "/var/abc"
     ErrorLog "/var/abc/logs/errorlog"
     WebAppDeploy . conn /
</VirtualHost>

<VirtualHost 192.168.1.201>
     ServerName "www.abc2.com:80"
     ServerAdmin "abc@abc2.com"
     DocumentRoot "/var/abc2"
     ErrorLog "/var/abc2/logs/errorlog"
     WebAppDeploy . conn /
</VirtualHost>

When I tried to upgrade to Tomcat 5, I found out that WebApp is 
deprecated and we should be using the JK connector. I changed the 
httpd.conf to:

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties

NameVirtualHost 192.168.1.201

<VirtualHost 192.168.1.201>
     ServerName "www.abc.com:80"
     ServerAdmin "abc@abc.com"
     DocumentRoot "/var/abc"
     ErrorLog "/var/abc/logs/errorlog"
     JkMount /*.jsp worker1
     JkMount /*.do worker1
</VirtualHost>

<VirtualHost 192.168.1.201>
     ServerName "www.abc2.com:80"
     ServerAdmin "abc@abc2.com"
     DocumentRoot "/var/abc2"
     ErrorLog "/var/abc2/logs/errorlog"
     JkMount /*.jsp worker2
     JkMount /*.do worker2
</VirtualHost>


Here is my Tomcat configuration

<Server>
   <Service>
     <Engine>
       <Host name="abc.com" debug="0" appBase="/var/abc" unpackWARs="false">
                 <Context path="" docBase="/var/abc" />
       </Host>

       <Host name="abc2.com" debug="0" appBase="/var/abc2" unpackWARs="false">
                 <Context path="" docBase="/var/abc2" />
       </Host>
     </Engine>
   </Service>
</Server>

I had to change the servlets to be named as .do and then add the 
JKMount statement, otherwise the servlets were not executing.

Any help is appreciated.

Thanks,
Naren



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: JK Connector not distinguishing between Virtual hosts

Posted by Bill Barker <wb...@wilshire.com>.
"Naren Koka" <na...@indidge.com> wrote in message 
news:7.0.1.0.0.20060516054359.02304800@indidge.com...
>I am using mod_jk with Tomcat 5 and Apache 2.2. JK is directing to the 
>default Host in Tomcat Server. It is not able to distinguish the sites. 
>When we go to abc2.com, it shows half the content from abc1.com, which has 
>a lot of files with the same name as abc2.com. Is this a known bug? Anybody 
>has seen it?
>
> Ealier, I was using WebApp connector for Name Based Virtual Hosting on my 
> Apache server. Everything was working fine.  Here is the httpd.conf when 
> using WebApp.
>
> LoadModule webapp_module modules/mod_webapp.so
> WebAppConnection        conn    warp    localhost:8008
>
> NameVirtualHost 192.168.1.201
>
> <VirtualHost 192.168.1.201>
>     ServerName "www.abc.com:80"
>     ServerAdmin "abc@abc.com"
>     DocumentRoot "/var/abc"
>     ErrorLog "/var/abc/logs/errorlog"
>     WebAppDeploy . conn /
> </VirtualHost>
>
> <VirtualHost 192.168.1.201>
>     ServerName "www.abc2.com:80"
>     ServerAdmin "abc@abc2.com"
>     DocumentRoot "/var/abc2"
>     ErrorLog "/var/abc2/logs/errorlog"
>     WebAppDeploy . conn /
> </VirtualHost>
>
> When I tried to upgrade to Tomcat 5, I found out that WebApp is deprecated 
> and we should be using the JK connector. I changed the httpd.conf to:
>

It's not deprecated in Tomcat 5:  It doesn't work at all ;-).

> LoadModule jk_module modules/mod_jk.so
> JkWorkersFile conf/workers.properties
>
> NameVirtualHost 192.168.1.201
>
> <VirtualHost 192.168.1.201>
>     ServerName "www.abc.com:80"
>     ServerAdmin "abc@abc.com"
>     DocumentRoot "/var/abc"
>     ErrorLog "/var/abc/logs/errorlog"
>     JkMount /*.jsp worker1
>     JkMount /*.do worker1
> </VirtualHost>
>
> <VirtualHost 192.168.1.201>
>     ServerName "www.abc2.com:80"
>     ServerAdmin "abc@abc2.com"
>     DocumentRoot "/var/abc2"
>     ErrorLog "/var/abc2/logs/errorlog"
>     JkMount /*.jsp worker2
>     JkMount /*.do worker2
> </VirtualHost>
>

You don't mention what your setting is for 'UseCanonicalName'.  If it is 
'on', then your ServerNames don't match the Host names in your Tomcat 
configuration.

>
> Here is my Tomcat configuration
>
> <Server>
>   <Service>
>     <Engine>
>       <Host name="abc.com" debug="0" appBase="/var/abc" 
> unpackWARs="false">
>                 <Context path="" docBase="/var/abc" />
>       </Host>
>
>       <Host name="abc2.com" debug="0" appBase="/var/abc2" 
> unpackWARs="false">
>                 <Context path="" docBase="/var/abc2" />
>       </Host>
>     </Engine>
>   </Service>
> </Server>
>
> I had to change the servlets to be named as .do and then add the JKMount 
> statement, otherwise the servlets were not executing.
>
> Any help is appreciated.
>
> Thanks,
> Naren 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org