Hi,
 
Yes, I've been meaning to post these for some time now.  This setup seems to be working out for us.  If anyone has anything to add or modify here to make it better - great!  I cut and pasted this from our internal wiki - it looks fine in my email client here but if it doesn't come across clear, let me know and I'll reformat into something more standard.
 
Jason
 
Apache 2.0 + JBoss 3.2.1 w/ Tomcat bundle Guide

A lot of my notes came (almost verbatim) from Jon Barnett's technote: http://www.amitysolutions.com.au/documents/JK2-technote.pdf  (which doesn't seem to be there right now -- :(


Getting sources and building

This guide will show how to build all these packages from source distributions. If you find a binary file for the system you are interested in deploying on, great. But, be aware that some packages (especially the mod_jk packages) will require Apache and Tomcat source trees.

Downloading

All packages are assumed being placed into

/usr/local/src

Apache 2.0.x can be obtained from http://apache.mirror.digitalspace.net/httpd/

I am using Apache 2.0.47 in this guide.

mod_jk2 can be obtained from http://apache.mirror.digitalspace.net/jakarta/tomcat-connectors/jk2/

I am using mod_jk2 2.0.2 in this guide.

JBoss can be obtained from http://www.jboss.org/index.html?module=html&op=userdisplay&id=downloads

I am using jboss 3.2.1 with Tomcat 4.1.24 integrated. (Starting with jboss 3.2.2, tomcat is part of the standard download.)

Tomcat can be obtained from http://apache.mirror.digitalspace.net/jakarta/tomcat-4/

I am using tomcat 4.1.27 in this guide. Separate tomcat source tree is only necessary for mod_jk2 build. This instance of tomcat will not need to be built.

Building

Apache 2.0

  1. # cd /usr/local/src
  2. # tar zxf httpd-2.0.47.tar.gz
  3. # cd httpd-2.0.47
  4. # ./configure --enable-so --prefix=/usr/local/apache2
    (This will enable dynamic module support and place the apache installation into /usr/local/apache2. If you need SSL support, include a
    --enable-ssl
    option in this command.)
  5. # make
  6. # make install

If you want more details than this, consult the INSTALL file in the apache distribution.

mod_jk2

  1. # cd /usr/local/src
  2. # tar zxf jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz
  3. # tar zxf tomcat-4.1.27.tar.gz
  4. # cd jakarta-tomcat-connectors-jk2-2.0.2-src
  5. # cd jk/native2
  6. You need to edit the configure file in this directory. Change line 8146 to be
    if ${TEST} ! -d ${tempval}/; then
    and save. (The old line should read
    if ${TEST} ! -f ${tempval}/; then
    - if line 8146 does not contain this, find this line.)
  7. # ./configure \
    	--with-tomcat41=/usr/local/src/jakarta-tomcat-4.1.27/ \
    	--with-apache2=/usr/local/apache2/ \
    	--with-apxs2=/usr/local/apache2/bin/apxs
  8. # make
  9. # cp ../build/jk2/apache2/*.so /usr/local/apache2/modules
  10. # libtool --finish /usr/local/apache2/modules

JBoss

  1. # cd /usr/local/src
  2. # unzip -d /usr/local jboss-3.2.1_tomcat-4.1.24.zip


Configuring

The bundled tomcat is already setup to support AJP connections on port 8009 by default. We just need to tell Apache how to connect. We first need a workers2.properties file.

  1. # cd /usr/local/apache2/conf
  2. # vi workers2.properties
  3. A simple installation consists of:
    [logger]
    level=DEBUG
    
    [config:]
    file=${serverRoot}/conf/workers2.properties
    debug=0
    debugEnv=0
    
    [uriMap:]
    info=Maps the requests.  Options: debug
    debug=0
    
    # Define the communication channel
    [channel.socket:localhost:8009]
    info=Ajp13 forwarding over socket
    tomcatId=localhost:8009
    
    # Map the tomcat JMX webapp to the web server uri space
    [uri:/jmx-console/*]
    info=Map the whole webapp
    
    [shm:]
    info=Scoreboard.  Required for reconfiguration and status with multiprocess servers
    file=${serverRoot}/logs/jk2.shm
    size=100000
    debug=0
    disabled=0
    
    Notice that the server I'm using here is my localhost. Yours may be different. Also, I'm mapping the JMX console to the apache uri space. Add as many [uri: lines as you need for your web applications.
  4. You need to create the scoreboard file. It's an empty file.
    # touch ../logs/jk2.shm
  5. Add a LoadModule directive in the httpd.conf file.
    LoadModule jk2_module modules/mod_jk2.so
    Search for the term LoadModule in the httpd.conf file, insert this line in that section.


Running and Testing

JBoss must be started first, followed by Apache

  1. # cd /usr/local/jboss-3.2.1_tomcat-4.1.24/bin
  2. # nohup ./run.sh &
  3. Wait for JBoss to finish it's startup routine (use
    tail -f nohup.out
    to verify)
  4. Start apache
    # /usr/local/apache2/bin/apachectl start

You should now be able to point your browser to the server

(http://localhost/) and see the welcome Apache page. Click on the "documentation" link and you should see the Apache manual. This confirms that Apache is installed properly and running. Let's try accessing the JMX console. Point your browser to http://localhost/jmx-console/. You should see the JBoss JMX console. If not, you need to troubleshoot. If you are getting a "404 - File not found" from Apache, then either you mistyped the webapp name in the workers2.properties file or you misspelled or misplaced the "workers2.properties" file and apache cannot find it. Check the error_log in /usr/local/apache2/logs/error_log.


Deploying

After all is well, you may want to deploy your webapp. You need to do two things:

  1. Put the war file in the {jbosshome}/server/default/deploy directory - JBoss should deploy automatically
  2. Tell Apache about it - by adding another [uri: line to the workers2.properties file. You will have to restart Apache. (Is there a way to do this without restarting Apache?)
 
 
-----Original Message-----
From: Wiebe de Jong [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 2:08 PM
To: [EMAIL PROTECTED]
Subject: RE: [Juglist] Apache 2.0 + mod_jk2 + tomcat/jboss bundle

Jason,

 

I am trying to setup Apache/JK2/Tomcat/JBoss on RedHat and came across your posting on JUGLIST. You mentioned that you would be glad to share your notes. That would be great!

 

I have been doing Struts development on JBoss/Tomcat standalone, but I need to add Apache so that I can add some PHP to my site.

 

Thanks

 

Wiebe de Jong

http://frontierj.blogspot.com

_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to