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 22:21:43 UTC
Virtual Hosts in Tomcat 5, Apache2 using JK Connector
I am using mod_jk with Tomcat 5 and Apache 2.2 and
jakarta-tomcat-connectors-1.2.15. Virtual hosting on this environment
is not working. It looks like JK is directing all traffic 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 and half from abc2.com. There are many files with the same
names in the two domains - and JK seems to be failing to identify the
domains. Any help is apreciated
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