Thursday, 11 July 2013

Easy way to Install and configure Apache tomcat Intigration with mod_jk.so in Linux/RHEL/Centos


Apache HTTP Server : commonly none as a Apache, it's web server application. From long Apache is most popular web server in the internet. Normally Apache run on a Linux like Operating system, Apache developed and maintain by Apache software Foundation, it's open source application.
Apache handling only static pages.

Tomcat : Tomcat is a container, it's contain java servlet. Tomcat handling java servlet dynamic page requests. Tomcat latest version available here  http://tomcat.apache.org

We are here for discussing and integration of apache and tomcat on Linux platform. Now, I am using centos 6.2 server, Jre1.6, apache 2.2.x , tomcat7.0.29 for done this configuration.

1.First Install jre download from here :
http://www.oracle.com/technetwork/java/javase/downloads/jre6downloads-1902815.html

# ls
lost+found
jre-6u45-linux-x64-rpm.bin 
# chmod +x jre-6u45-linux-x64-rpm.bin
# ./jre-6u45-linux-x64-rpm.bin
# java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
2. Install apache http server and components
#yum install httpd
#yum httpd-devel     ( it's provides /usr/sbin/apxs
#yum apr-devel       (provides the appropriate include files)
#apr                 (it's required by apr-devel)
#apr-util-devel (it's required by httpd-devel)
#apr-util           (it's required by apr-util)
# rpm -qa | grep httpd
httpd-manual-2.2.15-28.el6.centos.noarch
httpd-devel-2.2.15-28.el6.centos.x86_64
httpd-tools-2.2.15-28.el6.centos.x86_64
httpd-2.2.15-28.el6.centos.x86_64
you will see look like this, depends on Linux architecture.
Install compiler packages
#yum install gcc gcc-cpp gcc-c++
2. Download and Install apache tomcat package http://tomcat.apache.org/download-70.cgi
#tar -zxvf apache-tomcat-7.0.29.tar.gz
3. Download tomcat-connectors   http://tomcat.apache.org/connectors-doc/
#tar -xvf tomcat-connectors-1.2.37-src.tar
# cd tomcat-connectors-1.2.32-src/native/
# which usr/sbin/apxs                                                                                                                                 
# ./configure --with-apxs=/usr/sbin/apxs --enable-api-compatibility
# make
# make install 
after completed this activity you will get mod_jk.so file in /usr/lib64/httpd/modules/mod_jk.so
if get it , going well
Installation part has been completed, let's start configuration part
4. Open httpd.conf file and add end of line.
# vi /etc/httpd/conf/httpd.conf
JkWorkersFile "/etc/httpd/conf/worker.properties"
        JkLogFile "/var/log/httpd/mod_jk.log"
        JkRequestLogFormat "%w %V %T"
        JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
        JkLogLevel info
        JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkMount / worker1           (allow for all project)
JkMount /* worker1
allow specific project like as examples 
JkMount /examples worker1          
JkMount /examples* worker1

Note : use one given above both( allow for all project or allow specific project)
5. create worker.properties file and make the entry
#vi  /etc/httpd/conf/worker.properties
worker.list=worker1
# Define Node1
worker.worker1.port=8009
orker.worker1.host=127.0.0.1
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
save and exit
6. open the server.xml file make some changes
#vi /opt/apache-tomcat-7.0.29/conf/server.xml
 <!-- You should set jvmRoute to support load-balancing via AJP ie :-->
<Engine name="Catalina" defaultHost="localhost" jvmRoute=" jvmRoute">
to 
 <Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
and
<Engine name="Catalina" defaultHost="localhost">
to
    <!--<Engine name="Catalina" defaultHost="localhost"> -->
save and exit.
Sart process : First start Tomcat then start Apache
#/opt/apache-tomcat-7.0.29/bin/startup.sh
#/etc/init.d/httpd start
Open the Browser and check the URL : http://localhost/examples
able to find this page

Apache Tomcat Examples

You have successfully done this job congratulation!
 
 
 

No comments:

Post a Comment

Install XRDP in Centos 7

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum update yum groupinstall "GNOME Desktop" ...