0

I have setup Tomcat behind Apache server and have connected them using mod_jk. Now, I need to serve a static file for time being the war is being deployed on tomcat and services are up and running. I am not able to find a way to do this.

EDIT: worker.properties are as below:

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

mod_jk.conf

LoadModule    jk_module  /etc/httpd/modules/mod_jk.so
<IfModule jk_module>
JkMount /* worker1
JkMountCopy All
JkWorkersFile /etc/httpd/conf/workers.properties
JkShmFile     /var/log/httpd/mod_jk.shm
JkLogFile     /var/log/httpd/mod_jk.log
JkLogLevel    error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
</IfModule>
Nitesh Kumar Anand
  • 621
  • 1
  • 6
  • 18
  • please post your log and mod_jk.con + workers.properties file – Ghayel Apr 16 '16 at 16:50
  • @Ghayel, I have added info about 2 files. And about the logs, I have not customized it at all. It is default that came with Apache 2.4.6. – Nitesh Kumar Anand Apr 16 '16 at 23:34
  • in your mod_jk.conf file there is entry for mod_jk.log i.e. `JkLogFile /var/log/httpd/mod_jk.log` copy paste this – Ghayel Apr 17 '16 at 08:13
  • @Ghayel, that file is blank. – Nitesh Kumar Anand Apr 18 '16 at 14:18
  • This file usually contains `[Sun Apr 17 03:24:53.388 2016] [28283:140277036681184] [info] init_jk::mod_jk.c (3591): mod_jk/1.2.41 initialized` It means you miss-configured. Let me write steps as to how you can setup it as answer. If you have any problem mail me to ghayel at gmail dot com – Ghayel Apr 19 '16 at 05:53

2 Answers2

0

Follow these steps to setup to install mod_jk connector:

# cd /var/java/

# mkdir mod-jk

# cd mod-jk

# wget http://www.eu.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.41-src.tar.gz

# tar -xf tomcat-connectors-1.2.41-src.tar.gz

# yum install -y httpd-devel gcc gcc-c++ make libtool
# cd tomcat-connectors-1.2.41-src/native
# ./configure --with-apxs=/usr/sbin/apxs
# make
# libtool --finish /usr/lib64/httpd/modules
# make install

# service httpd restart
Ghayel
  • 1,113
  • 2
  • 10
  • 19
0

I realized that I should host a small application with static page on apache server and add ajax call to test tomcat services to see if they are up. Added a "no-jk" configuration to this mod_jk.conf as it has JkMount /* worker1 to binds all requests to tomcat. I added SetEnvIf Request_URI "/static-app/*" no-jk. This solved my problem.

Nitesh Kumar Anand
  • 621
  • 1
  • 6
  • 18