martedì 15 giugno 2010

Install mod_jk on CentOS 5.5

This little tutorial requires that apache and tomcat are installed. I used apache 2.2.3 and tomcat 6.0.20

Here are the instructions
-download mod_jk from tomcat website
-cd native
-./buildconfig.sh
-verify if you have apxs (Apache Extension tool). if not install latest httpd-devel rpm (you can search for it with "yum provides */apxs"
-./configure --with-apxs=/usr/sbin/apxs
-cp mod_jk.so /usr/lib64/httpd/modules/ (or wherever your lib modules are)
-touch /etc/httpd/workers.properties
-vim /etc/httpd/workers.properties

create a workers.properties file in your etc/httpd dir, with at least:

# workers.properties -
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/lib/java
ps=/

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

add at least this to your httpd.conf

# Where to find workers.properties
JkWorkersFile /etc/httpd/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"



then, if you have not any VirtualHost, just add all the JkMount you need in order to reach your tomcat apps.
The following two lines query tomcat each time a.jsp or .do page is asked.
JkMount /*.jsp ajp13
JkMount /*.do ajp13
If you do have VirtualHosts defined, then be aware that Jkmounts are not inherited in any way. So, or you define JkMount inside all the Virtual hosts you expect to serve your apps, or define them globally and use JkMountCopy in the vhosts.

Nessun commento:

Posta un commento