Mar 15

xampptomcat6This post discusses the auto configuration of Tomcat inside a XAMPP. The tomcat configuration file is automatically generated when the services are started.

The steps would be same ( though directories are different) if you want to do this on  Apache- Tomcat setup.

For Auto Configure to work.

1) Apache in XAMPP references the tomcat.conf file.

The  httpd.conf file in stored in ${xampp_home}\apache\conf. It has setting for tomcat. See Below

# Tomcat settings
Include “conf/extra/mod_jk.conf”

2)The tomcat configuration file references the auto generated configuration file.

The contents of mod_jk.conf in  ${xampp_home}\apache\conf

# Tomcat auto-configure

# This is location of automatically generated file

Include “C:/devkit/xampp/tomcat/conf/auto/mod_jk.conf”.

Apache refers to http.conf file. This file refers mod_jk.conf file which loads the auto generated tomcat mod_jk.conf (better name would be mod_jk.conf_auto ) reference file.

tomcat-auto-gen2

3) Tomcat needs to know if auto generated file will be used

The server.xml file in  ${xampp_home}\tomcat\conf has setting to auto create the Xampp-Apache-Tomcat conf file.

<Engine name=”Catalina” defaultHost=”localhost”>
<Listener className=”org.apache.jk.config.ApacheConfig” modJk=”C:/devkit/xampp/apache/modules/mod_jk.so”/>

….

</Engine>

4) Tomcat workers.properties need to set correctly

uses the setting in worker.properties in  ${xampp_home}\tomcat\conf\jk for generating the auto configuration file . The link to the files is mod_jk.conf and  workers.properties

Tomcat load server.xml and workers.properties to auto generated the mod_jk.conf(auto) file used by apache.

tomcat-auto-gen1

The contents of auto generated file : Any change to this file is lost when services are restarted.

########## Auto generated on Mon Feb 08 13:44:07 PST 2010##########
<IfModule !mod_jk.c>
LoadModule jk_module “C:/devkit/xampp/apache/modules/mod_jk.so”
</IfModule>

JkWorkersFile “C:/devkit/xampp/tomcat/conf/jk/workers.properties”
JkLogFile “C:/devkit/xampp/tomcat/logs/mod_jk.log”

JkLogLevel emerg

<VirtualHost localhost>
ServerName localhost

JkMount /test ajp13
JkMount /test/* ajp13

JkMount /examples ajp13
JkMount /examples/* ajp13

JkMount /newdev ajp13
JkMount /newdev/* ajp13

JkMount /host-manager ajp13
JkMount /host-manager/* ajp13

JkMount /redesigndev ajp13
JkMount /redesigndev/* ajp13

JkMount /docs ajp13
JkMount /docs/* ajp13

JkMount /manager ajp13
JkMount /manager/* ajp13
</VirtualHost>

Tags: ,

Leave a Reply