Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Integrate Apache2 and Tomcat 7 Using mod_jk

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 766
    Comment on it

    As we know our most of the projects in Java is run using Tomacat application server. Sometimes we also need some web server like apache2 for other functionalities like wordpress integration.
    In such situation our project need both of the server to run the application.
    We can connect tomcat 7 and apache2 using mod_jk connector. Here is the code to integrate it:

    First we need to insatll apache 2 

    sudo apt-get install apache2
    sudo apt-get install tomcat7
    sudo apt-get install tomcat7-admin

    Now install mod_jk using code:

    sudo apt-get install libapache2-mod-jk

    Now go to tomcat directory and open file server.xml

    Uncomment line

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

    Now create a properties file in apache2

    sudo vim /etc/apache2/workers.properties

    Write the code:

    Paste the following text:

    # Define 1 real worker using ajp13
    worker.list=worker
    # Set properties for worker (ajp13)
    worker.worker.type=ajp13
    worker.worker.host=localhost
    worker.worker.port=8009

    Now to configure the URL Apache should pass through the Tomcat, create file 000-defaultat following location

    sudo vim /etc/apache2/sites-enabled/000-default

    And following lines in the file:

    <VirtualHost *:80>
    .......................................
    .......................................
    JkMount /tomcat-demo* worker1
    </VirtualHost *:80>

    Restart both server.

     

 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: