Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Installing mod_jk on Apache on Ubuntu

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4.41k
    Comment on it

    This tutorial will help a user to learn how to install mod_jk module and what is mod_jk.mod_jk is basically Apache module which is used to connect the Servlet Container [also known as Web Container] with the Web Servers (i.e. Apache, iPlanet, Sun ONE). We use mod_jk module for loadbalancing and also use as a connector between Apache web server and Apache Tomcat together.


    1- We use a package called libapache2-mod-jk to install mod_jk module in ubuntu.

    2- To install apache module "mod_jk" we execute the below command in our terminal

     sudo apt-get install libapache2-mod-jk
    

    3- Now we will enable mod_jk loading :Here we put a link in /etc/apache2/mods-enabled/jk.load which is mapped to /etc/apache2/mods-available/mod_jk.load. Which enables loading of mod_jk module when we restart apache.

    Creating link in /etc/apache2/mods-enabled/jk.load
    
    LoadModule jk_module /usr/lib/apache2/mods-available/mod_jk.load
    

    5-Create mod_jk conf file and place it in /etc/apache2/mods-available/

    <IfModule jk_module>
    
    # Where to find workers.properties
    # Update this path to match your conf directory location
    JkWorkersFile /etc/apache2/jk_workers.properties
    
    # Where to put jk logs
    # Update this path to match your logs directory location
    JkLogFile /var/log/apache2/mod_jk.log
    
    # Set the jk log level [debug/error/info]
    JkLogLevel info
    
    # 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"
    
    # Shm log file
    JkShmFile /var/log/apache2/jk-runtime-status
    
    </IfModule>
    

    6- Enable mod_jk configurations: Here we put a link in /etc/apache2/mods-enabled/jk.conf which
    is mapped to /etc/apache2/mods-available/mod_jk.conf. This will enable mod_jk configuration
    when restart apache.

    7- Now we will create a worker properties file: Which we place at the location below

    /etc/apache2/mod_jk_workers.properties
    

    here we define workers in the worker list.

    # Define 1 real worker named ajp13
              worker.list=ajp13    
    
        # Set properties for worker named ajp13 to use ajp13 protocol,
        # and run on port 8009
             worker.ajp13.type=ajp13
             worker.ajp13.host=localhost 
             worker.ajp13.port=8009
             worker.ajp13.lbfactor=50
             worker.ajp13.cachesize=10
             worker.ajp13.cache_timeout=600
             worker.ajp13.socket_keepalive=1
             worker.ajp13.socket_timeout=30
    

    8- now we will configure the url

    <VirtualHost *:80>
        ...
        # Send everything for context "/context" to worker ajp13
        JkMount /context/ ajp13
        JkMount /context/* ajp13
        ...
       </VirtualHost>
    

    9- Now restart Apache web server.

    10- For more information see the link below:

    https://tomcat.apache.org/tomcat-3.3-doc/mod_jk-howto.html

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: