You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nikola Milutinovic <Ni...@ev.co.yu> on 2003/12/02 15:10:42 UTC

Re: Tomcat FAQs on Wiki - mod_jk2 howto

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


Configure tomcat for LDAP

Posted by Damien Pacaud <dp...@prisma-presse.com>.
Hi, i want to use LDAP to athenticate my users on a JSP application and
would like to know how to configure TOMCAT so that i can acces the login of
the current user through a jsp ?

for now, i have it all set on apache, in the virtual host using ath_ldap .
my problem is that the request.getRemoteUser() method always returns null in
my jsp application...
but apache writes the login of the user in the acces.log ....so i guess it
is a conf problem with tomcat...

Does anyone have an idea, or a url that could halp ??
thanks in advance



-----------------------
le présent message (ainsi que ses éventuelles pièces jointes) peut
contenir des informations confidentielles. Etant établi à l'intention de ses
destinataires, son utilisation ou diffusion non autorisée est interdite.

Tout message électronique étant susceptible d'altération, Prisma Presse
décline toute responsabilité au titre dudit message en cas de falsification.

Ce message a été traité par un anti virus et aucun virus connu n'a été détecté.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org