You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Johan Louwers <Su...@dds.nl> on 2003/10/01 10:11:11 UTC

solution jakarta-tomcat and virtual hosts

I have asked the question a couple of times in this mailing list and at some
places on usenet. I solved this problem at the end and will give a small
example of the things I did to make this work. I will post this on the
mailinglist and in some usenet groups in the hope some people can use this
information.If there are people that have things to add to this paper please
do so and tell me about it :-)




[problem situation]
1 server and 2 site's. Only port 80 can be used due to firewall rules. Both
site's are in need of JSP support under port 80.

We have www.someserver.com and mnt.someserver.com

www.someserver.com is located at /export/home/webroot/www.someserver.com
mnt.someserver.com is located at /export/home/webroot/mnt.someserver.com

both the JSP files and normal HTML files have to be located at the same
location.




[STEP 1]
I will not go in detail to this step.
 - Build and/or install apache webserver
 - Build and/or install jakarta-tomcat
 - Build and/or install a mod_jk connector

If you have some problems with installing jakarta-tomcat and or mod_jk
please take a look at www.johnturner.com most of the question can be solved
here.




[STEP 2]
Create 2 virtual domains in the Apache webserver.
(if apache is located at /usr/local/apache) BACKUP
/usr/local/apache/conf/httpd.conf and after that open the original with VI
or some editor you have on your system.


Add the following lines:

###########################################
# BEGIN virtualhost www.someserver.com
 <VirtualHost 10.99.1.115>
         ServerAdmin Johan.Louwers@someserver.com
         DocumentRoot /export/home/webroot/www.someserver.com
         ServerName www.someserver.com
         ErrorLog /export/home/weblog/error-log_www.someserver.com
         CustomLog /export/home/weblog/common-log_www.someserver.com common
 </VirtualHost>
# END virtualhost www.someserver.com
###########################################

###########################################
# BEGIN virtualhost mnt.someserver.com
 <VirtualHost 10.99.1.115>
         ServerAdmin Johan.Louwers@someserver.com
         DocumentRoot /export/home/webroot/mnt.someserver.com
         ServerName mnt.someserver.com
         ErrorLog /export/home/weblog/error-log_mnt.someserver.com
         CustomLog /export/home/weblog/common-log_mnt.someserver.com common
 </VirtualHost>
# END virtualhost mnt.someserver.com
###########################################

If you followd the correct way of instaling the mod_jk connector you will
also have a line in your httpd.conf file something like this:

LoadModule jk2_module modules/mod_jk2.so

Make sure to save the file. Restart Apache and test if all works correct.




[STEP 3]
(if jakarta-tomcat is located at /usr/local/jakarta-tomcat-4.1.27/) open
/usr/local/jakarta-tomcat-4.1.27/conf/server.xml in VI or some editor you
have on your system.

Add the following lines:

<!--########################################## -->
<!-- www.someserver.com JSP files -->
      <Host name="www.someserver.com" debug="0"
appBase="/export/home/webroot/www.someserver.com" unpackWARs="true"

autoDeploy="true">
         <Context path="" docBase="" debug="1"/>
         <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="wwwsomes_access_log." suffix=".txt"
pattern="common" resolveHost="flase"/>
      </Host>
<!--########################################## -->




<!--########################################## -->
<!-- mnt.someserver.com JSP files -->
     <Host name="mnt.someserver.com" debug="0"
appBase="/export/home/webroot/mnt.someserver.com" unpackWARs="true"

autoDeploy="true">
        <Context path="" docBase="" debug="1"/>
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="mntsoms_access_log." suffix=".txt" pattern="common"
resolveHost="false"/>
        </Host>
<!--########################################## -->




[STEP 4]
(if apache is located at /usr/local/apache)  open
/usr/local/apache/conf/workers2.properties with VI and add the following
lines:

#########################################

# worker properties www.someserver.com
[uri:www.someserver.com/*.jsp]
worker=ajp13:localhost:8009


# worker properties mnt.someserver.com
[uri:mnt.someserver.com/*.jsp]
worker=ajp13:localhost:8009

#########################################




[STEP 5]
Shutdown apache and tomcat if they are running and start them up again. You
should have now jsp access on

http://www.someserver.com and on http://mnt.someserver.com

Regards,
Johan Louwers


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