Apache Integration with Tomcat Apache

Application server performance like (Jboss / Tomcat) is slower than webservers like (IIS / Apache ).

Jboss : Java based application server (J2EE)
Tomcat : Java servlet engine.
Tomcat Apache is an open source application server written in Java, The default port for  java application server is 8080 and apache 80.

In order to integrate apache as front-end and application server as back-end, required proxy module or mod_jk connector.
In our example we are configuring Tomcat Apache  using proxy gateway between apache and Apache Tomcat application server as part of installation and configuration.

Proxy : ProxyPass and ProxyPassRevers(proxy_module modules/mod_proxy.so).

Proxy module redirect the request received on port 80 to 8080 internally which will not be visible to users.
Apache  Tomcat   installation and configuration guide has prepared on following platform and services.

Operating System          : CentOS release 6.5 (Final) 32bit
Webserver                 : httpd-2.2.15-29.el6.centos.i686
Jboss                     : apache-tomcat-6.0.39
Domain
                    : demo.com
Aapache Tomcat  server IP : 192.168.1.44
Scope              : Apache integration with Apache Tomcat using (mod_proxy)

Dependencies:
Centos / Redhat Box : 1 No’s ( virutal / Physical)

Packages            : httpd-2.2.15-29.el6.centos.i686 , JDK ( jdk-7u51-linux-x64.rpm) , apache-tomcat-6.0.39

Steps :

Step 1: Install and configuring JDK, Apache & Apache Tomcat webserver.

Step 2: Apache integration with Apache Tomcat configuration

Step 3: Verifying

Step 1: Install and configuring jdk, Tomcat Apache webserver  .

1.1

Login as root user to 192.168.1.44.
Install apache rpm package from repository using yum command line utility.

[root@experts ~]#yum install http httpd-devel

start apache service and set service on at boot level

[root@experts ~]#chkconfig httpd on

1.2
download latest jboss from jboss.org website suitable to meet your requirements. in our guide we are going to use apache-tomcat-6.0.39

[root@experts ~]#mkdir /apps

[root@experts ~]#cd /apps

[root@experts apps]#wget http://psg.mtu.edu/pub/apache/tomcat/tomcat-6/v6.0.39/bin/apache-tomcat-6.0.39.tar.gz

1.3
Extract apache-tomcat source package
[root@experts apps]#tar -zxvf apache-tomcat-6.0.39.tar.gz

1.4
Download jdk and install , in our guide we have already downloaded in /opt/
you can download suitable jdk from http://www.oracle.com/technetwork/java/javase/downloads/

[root@experts ~]#cd /opt

[root@experts ~]#rpm -ivh jdk-7u45-linux-i586.rpm

[root@experts ~]#java -version

set  JAVA_HOME and PATH environment in .bash_profile

[root@experts ~]#vi /root/.bash_profile

export JAVA_HOME=/usr/java/jdk1.7.0_45

PATH=$PATH:$HOME/bin:/usr/java/jdk1.7.0_45/bin

export PATH

Save and Exit.

[root@experts ~]#source /root/.bash_profile

Verify JAVA_HOME environment .

[root@experts ~]#env |grep JAVA_HOME

output:

JAVA_HOME=/usr/java/jdk1.7.0_45

Step 2: Apache integration with Apache Tomcat configuration

2.1

Edit the Apache configuration file to specify ProxyPass and ProxyPassRevers context as shown below.

[root@experts ~]#vi /etc/httpd/config/httpd.conf

ProxyRequests Off

ProxyPass /examples http://localhost:8080/examples

ProxyPassReverse /examples

http://localhost:8080/examples

#

<Location “/examples”>

Order allow,deny

Allow from All

</Location>

Save & Exit.

2.2

Tomcat Apache configuration files and locations as show below.

/apps/apache-tomcat-6.0.39/bin : Start and Stop scripts

/apps/apache-tomcat-6.0.39/lib : Drivers ODBC and MYSQL

/apps/apache-tomcat-6.0.39/logs : Logs

/apps/apache-tomcat-6.0.39/webapps : application container

/apps/apache-tomcat-6.0.39/conf    : Apache Tomcat configuration files.

2.3

Start Apache Tomcat service using below command

[root@experts ~]cd /apps/apache-tomcat-6.0.39/bin

[root@experts ~] ./startup.sh

Shutdown Apache Tomcat service using below command

change the directory structure to jboss script location

[root@experts ~]cd /apps/apache-tomcat-6.0.39/bin

[root@experts ~]./shutdown.sh

Step 3: Verifying

Open the browser from a client machine and invoke the url :http://192.168.1.44/examples

the above URL must be accessible without suffix of port number 8080.

Thanks for watching, for more details visit www.demo.com

For more Detail refer Video :

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk