Results 1 to 10 of 10

Thread: Tutorial: Using Tomcat with Apache (mod_jk)

Threaded View

  1. #1
    Join Date
    Nov 2005
    Posts
    24
    Rep Power
    9

    Lightbulb Tutorial: Using Tomcat with Apache (mod_jk)

    Introduction

    As standard, Zimbra runs itself on port 80. However, this means you can't use Apache or access any other website through that server. If you are using your server only as a groupware box, this is no bother. But if you are using it in the situation I am with other servers, this is no good. This tutorial will:

    a.) Configure Tomcat to host on Port 7070 (as in M1)
    b.) Download and install the mod_jk RPM
    c.) Configure mod_jk to access Zimbra on /zimbra/
    d.) Configure Apache to start on system boot

    All this has been done on CentOS 4.2 but should work with Red Hat Enterprise Linux 4 but may need to be adjusted for Fedora Core 4 or SUSE.

    Step 1: Removing iptables rule

    Code:
    nano /opt/zimbra/tomcat/conf/server.xml
    Find the line that says "<!-- user services connector, no SSL -->"
    Replace
    Code:
    <Connector port="80"' with
    '<Connector port="7070"'
    Save and Close
    Code:
    nano /opt/zimbra/tomcat/webapps/zimbra/WEB-INF/web.xml
    Find
    Code:
    <env-entry-name>httpPort</env-entry-name>
    		 <env-entry-value>80</env-entry-value>
    and replace it with:
    Code:
    <env-entry-name>httpPort</env-entry-name>
     		 <env-entry-value>7070</env-entry-value>
    Restart Tomcat:

    Code:
    /opt/zimbra/bin/tomcat restart
    Step 2: Downloading and Installing mod_jk

    Code:
    wget http://mirrors.dotsrc.org/jpackage/1.6/redhat-el-3.0/free/RPMS/mod_jk-ap20-1.2.14.1-2jpp.i386.rpm
    rpm -ivh mod_jk-ap20-1.2.14.1-2jpp.i386.rpm
    Step 3: Configure Tomcat to allow access to AJP

    Since M2, you need to configure Tomcat to allow mod_jk access to it by AJP 1.3.

    Code:
    nano /opt/zimbra/conf/server/server.xml
    Add this line:

    Code:
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    before

    Code:
    <Engine name="Catalina" defaultHost="localhost">
    Save and close the file

    Step 4: Configuring mod_jk and Tomcat

    Code:
     cp /usr/share/doc/mod_jk-ap20-1.2.14.1/workers.properties.sample /etc/httpd/conf.d/
    nano /etc/httpd/conf/httpd.conf
    Add these lines to the bottom of the file
    Code:
    # Load mod_jk module
    LoadModule    jk_module  modules/mod_jk.so
    # Where to find workers.properties
    JkWorkersFile /etc/httpd/conf.d/workers.properties
    # Where to put jk logs
    JkLogFile     /var/log/httpd/mod_jk.log
    # Set the jk log level [debug/error/info]
    JkLogLevel    debug
    # SHM info
    JkShmFile   /etc/httpd/logs/jk.shm
    JkShmSize   10M
    # 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"
    # JkMount points
    JkMount /zimbra/mail ajp13
    JkMount /zimbra/auth/ ajp13
    JkMount /zimbra/js/*.jgz ajp13
    JkMount /zimbra/ ajp13
    JkMount /service/* ajp13
    
    Alias /zimbra/img/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/img/
    Alias /zimbra/js/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/js/
    Alias /zimbra/public/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/public/
    Alias /zimbra/skins/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/skins/
    Alias /zimbra/test/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/test/
    Alias /zimbra/zimlets/ /opt/zimbra/jakarta-tomcat-5.5.7/webapps/zimbra/zimlets/
    Save and close the file

    Code:
    nano /etc/httpd/conf.d/workers.properties
    Find these lines in the file and replace them with the ones below:

    Code:
    workers.tomcat_home=/opt/zimbra/tomcat
    workers.java_home=/opt/zimbra/java
    Save and close the file

    Step 4: Starting Apache

    Code:
    service httpd restart
    chkconfig httpd on
    Well, there you go. I have also posted it on my blog at http://sebpayne.blogspot.com which should also contain some Zimbra goodness! You should be able to access Zimbra at http://www.yourdomain.com/zimbra/ (the trailing slash is important)
    Last edited by sebpayne; 11-15-2005 at 01:02 PM. Reason: Updated for M2

Similar Threads

  1. Tomcat personnal php webapp
    By dzed in forum Administrators
    Replies: 21
    Last Post: 12-21-2007, 02:25 PM
  2. zmcontrol doesn't start mysql, apache or tomcat
    By pbwebguy in forum Administrators
    Replies: 5
    Last Post: 05-16-2006, 01:08 PM
  3. tomcat - macosx install - please help
    By gmsmith in forum Installation
    Replies: 3
    Last Post: 04-19-2006, 12:30 PM
  4. mod_jk with Apache and Tomcat
    By sebpayne in forum Administrators
    Replies: 1
    Last Post: 11-12-2005, 08:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •