Results 1 to 10 of 10

Thread: Tutorial: Using Tomcat with Apache (mod_jk)

  1. #1
    sebpayne is offline Intermediate Member
    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 02:02 PM. Reason: Updated for M2

  2. #2
    marcmac is offline Expert Member
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    13

    Default iptables no more

    the iptables port forwarding has been removed from the latest (M2) release.

  3. #3
    renzochavez77 is offline Junior Member
    Join Date
    Feb 2006
    Posts
    6
    Rep Power
    9

    Default Changes return to the original way

    Hello.. Y did all and my server works with zimbra in 7070 port...!.. Thaks, but i have a problem: I opened a port in my router the 7070 to the zimbra server host, because i have another server hosting the web site in port 80. So the users access from outside something like these: http://www.mydomain.com:7070
    My problem is.. when i reboot the server or restart the zimbra service, the archives server.xml , and web.xml return to the original way, whith the 80 port so, my users can't acces from outside the network.. they have to call me and i have to do the changes in these archives already. Do you know wath can i do, to these archives dont return to the original way an all can loggin from outside in the 7070 port after a rebooting.? (My network sometimes have electrical accidents..!)..

    Renzo Chavez

  4. #4
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,569
    Rep Power
    57

    Default

    Here's some instructions for changing the web port.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  5. #5
    bbska is offline Active Member
    Join Date
    Feb 2006
    Posts
    38
    Rep Power
    9

    Default

    I followed these instructions and have an interesting problem:

    I can connect to zimbra, and it starts to load, but then comes up with "A network service error has occured"

    It's a little box in the zimbra window before anything else loads.

    I can choose to send error report or just click ok. I can also view the details of the error which are:

    msg - Csfe service error
    code - service.FAILURE
    method - ZmCsfeCommand.prototype.invoke
    detail - system failure: request not allowed on port 80


    I changed the ports that zimbra runs on to 7070 with zmprov and the config files all show them setup correctly as per these instructions.

    I'm running CentOS 4.2 as well, so it's not a distro issue that I can tell.

    Anyone have any ideas?

  6. #6
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    Did you see:

    http://wiki.zimbra.com/index.php?tit...Apache_(mod_jk)

    This post may be out of date.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  7. #7
    bbska is offline Active Member
    Join Date
    Feb 2006
    Posts
    38
    Rep Power
    9

    Default

    Quote Originally Posted by KevinH
    Did you see:

    http://wiki.zimbra.com/index.php?tit...Apache_(mod_jk)

    This post may be out of date.


    I did use
    http://wiki.zimbra.com/index.php?tit...e_%28mod_jk%29
    (that had some minor errors in calling JkMount. it had ajp13 as the last argument in the jkmount command, but the last argument should be the worker to mount to ).

    I came to this post to see if the wiki post was missing something critical. I can see that the majority of the stuff in both is the same. The error persists regardless of which instruction set I follow, so for now I'm following the wiki instructions.

  8. #8
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    If you find any errors or things that need to be changed in the wiki please fix them.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  9. #9
    bbska is offline Active Member
    Join Date
    Feb 2006
    Posts
    38
    Rep Power
    9

    Default

    Quote Originally Posted by KevinH
    If you find any errors or things that need to be changed in the wiki please fix them.
    will update the wiki with the fixes.

    Anyone have any ideas about this one? I'm at a loss as to what the issue is, it seems like it's freaking out about traffic going on port 80. why would this be a problem?

  10. #10
    bbska is offline Active Member
    Join Date
    Feb 2006
    Posts
    38
    Rep Power
    9

    Default

    Quote Originally Posted by KevinH
    Did you see:

    http://wiki.zimbra.com/index.php?tit...Apache_(mod_jk)

    This post may be out of date.


    so very nice to see somebody completely hosed that wiki entry...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Tomcat personnal php webapp
    By dzed in forum Administrators
    Replies: 21
    Last Post: 12-21-2007, 03: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, 09: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
  •