It took about an hour to do this seemingly simple thing so I write it here not to forget it later! I needed Apache server to be as an interceptor for tomcat calls.
- install both Tomcat and Apache server
- Download the correct Tomcat connector. It should be something like mod_jk.so.
- Copy this file into your apache_dir/modules/
- In apache_dir/conf/ you need two more files called workers.properties and mod_jk.conf.
- The properties file tells Apache about the host, ports, connection pools, time outs, etc. It may look like this:
# comma separated list of workers
worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.connection_pool_size=10
worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=60
6- The mod_jk.conf file is what exactly you want the Apache server to do. Your need to reference this file from httpd.conf which is the main config file. For more configuration you might need to do a bit of reading about this file especially about JkMount and RewriteRule on Apache site. There are many examples as well.
LoadModule jk_module modules/mod_jk.so# Where to find workers.properties
JkWorkersFile conf/workers.properties
7- Restart the Apache server and you should be done!