Tomcat – What configuration changes needed on tcServer to work with Apache Web server

apache-2.2mod-jktomcat

I have Apache Webserver 2.2.17 and tcServer-6.0.20 and I want to dispatch requests from apache to tcserver.

I am using mod_jk.so and I have the following in httpd.conf

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module>
   JkWorkersFile /x/y/apache2/conf/workers.properties
   JkLogFile /x/y/apache2/logs/mod_jk.log
   JkLogLevel info
   JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
   JkMount /xyz/* ww
</IfModule>

My workers.properties file under /x/y/apache2/conf/workers.properties has

worker.list= ww
worker.ww.type=ajp13
worker.ww.port=12000
worker.ww.host=www.abc.com

I'm new to tcServer (and tomcat) and I don't know what changes I have to make in server.xml on tcServer to get this to work with Apache.

Any help would be appreciated.

Best Answer

You are looking for the AJP connector block in server.xml - by default it's the one listed with port 8009 in it. Basically all you need to do is change that to port 12000 to match your worker.

Here's a complete example of many of things you can set if needed - right now you're running a very bare-bones mod_jk setup, there are Jk* options for Apache you can tune and workers.properties.

<!-- Define an AJP 1.3 Connector on port 8009 -->
<!-- http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html -->
<Connector port="8009" protocol="AJP/1.3" allowTrace="false"
           emptySessionPath="false" enableLookups="false"
           maxPostSize="2097152" maxSavePostSize="4096" redirectPort="443"
           scheme="http" secure="false" URIEncoding="ISO-8859-1"
           useBodyEncodingForURI="false" xpoweredBy="false"
           useIPVHosts="false" address="127.0.0.1" backlog="10"
           bufferSize="-1" connectionTimeout="60000"
           keepAliveTimeout="60000" maxThreads="200" packetSize="8192"
           request.secret="" request.useSecret="false"
           request.shutdownEnabled="false" tcpNoDelay="true"
           tomcatAuthentication="true" />