Tim Funk wrote:
> Writing anything like that for the list is a good thing since we can
> always link to it in the archives ;)
Here goes.
STEP 1
------
Build "mod_jk2.so" and "jkjni.so" - do whatever needs to be done :-)
STEP 2
------
Place mod_jk2.so and jkjni.so with other Apache modules. In case of Mandrake
9.1, it was in /usr/lib/apache2-extramodules
STEP 3
------
Setup your Apache virtual host. Although you can run without it, I prefer going
the "right way". In my case:
/etc/httpd/conf.d/75_mod_jk2.conf
---------------------------------
#
# Sample Apache configuration file for mod_jk2.
# Include this in your httpd.conf.
#
<IfDefine HAVE_JK2>
<IfModule !mod_jk2.c>
LoadModule jk2_module extramodules/mod_jk2.so
</IfModule>
</IfDefine>
<IfModule mod_jk2.c>
#
# Restrict access to JK status handler
#
<Location "/jkstatus/">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.61.110
</Location>
</IfModule>
/etc/httpd/2.0/conf/vhosts/External.ev.co.yu
<VirtualHost 192.168.61.12:80>
ServerName External.ev.co.yu
ServerAdmin Nikola.Milutinovic@ev.co.yu
DocumentRoot /home/www/public_html
ErrorLog /home/www/logs/error.log
CustomLog /home/www/logs/access.log common
<IfModule mod_alias.c>
ScriptAlias /cgi-bin/ "/home/www/cgi-bin/"
</IfModule>
<Directory /home/www/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST HEAD OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST HEAD OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
<Directory /home/www/cgi-bin>
AllowOverride None
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
STEP 4
------
Setup virtual host on Tomcat.
/etc/tomcat/server.xml
----------------------
<Host name="External.ev.co.yu" debug="0" appBase="/home/www/webapps"
unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="external_access_log." suffix=".txt"
pattern="common"/>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs"
prefix="external_log." suffix=".txt" timestamp="true"/>
<Context docBase="ConsumerBill" path="/bill" reloadable="true">
<!-- setupt datasources as needed -->
</Context>
</Host>
STEP 5
------
Setup JK2 on Tomcat side.
/etc/tomcat4/jk2.properties
---------------------------
# Set the desired handler list
# handler.list=apr,request,channelJni
handler.list=apr,request,channelUnix
#
apr.NativeSo=/usr/lib/apache2-extramodules/jkjni.so
request.tomcatAuthentication=false
channelUnix.file=${jkHome}/work/tomcat.sock
STEP 6 !!!
----------
Ensure that jkjni.so picks up "serverConf" value from environment! The easiest
way for me was to edit /etc/tomcat/tomcat4.conf and add:
serverRoot=/etc/httpd/2.0
export serverRoot
If you're not using RPM version, just make sure that *that* variable is defined
in the script starting tomcat. This is needed by jkjni.so, so it can locate
workers2.properties. And if you're wondering, jkjni.so is needed to talk to UNIX
domain socket. Tomcat can open it without using "handler apr" and jkjni.so, but
refuses to communicate over it.
STEP 7
------
Setup your Apache side of JK2. Edit ${serverConf}/worker2.properties file. You
must define socket channel, ajp13 worker and at least one URI mapping to your
virtual host. Needless to say, VHost definitions on Tomcat and Apache must
(should?) match.
/etc/httpd/2.0/conf/workers2.properties
---------------------------------------
[logger]
level=DEBUG
[config:]
debug=0
debugEnv=0
[uriMap:]
info=Maps the requests. Options: debug
debug=0
# Alternate file logger
[logger.file:0]
level=DEBUG
file=/var/log/httpd/mod_jk2.log
[workerEnv:]
info=Global server options
timing=1
debug=0
[channel.un:unixsock]
info=Main socket to Tomcat engine
file=/var/tomcat4/work/tomcat.sock
[status:]
info=Status worker, displays runtime informations
[ajp13:unixsock]
info=Default AJP 1.3 worker
channel=channel.un:unixsock
[uri:/jkstatus/*]
info=Display status information and checks the config file for changes.
group=status:
[uri:external.ev.co.yu/bill]
info=Consumers bill
group=ajp13:unixsock
STEP 8
------
Restart Tomcat and then Apache.
Nix.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
|