Apache - Tomcat Connector
Developers are against the idea of publishing Application Server directly to end users. For achieving that we use Web Servers to interact with end users and Web Server - Application Server layer is not visible to the users. In this post we are going to explain how we can use apache as web server to achieve this.
We will be explaining the following scenarios
Scenario 1. Apache Tomcat as Application Server (host name : tomcat1, IP Address : 10.0.0.1) and Apache as WebServer (host name : apache1, IP Address : 172.16.0.1)
In the Apache Tomcat Server, we need to create an ajp13 connection on PORT 8009, for doing that locate the server.xml file. Suppose the apache tomcat is installed on /usr/local/tomcat, then server.xml file will be locates under /usr/local/tomcat/conf folder.
Open the server.xml in your favourite editor
You will find the following, if it is commented then uncomment the same
After that you will see the following
in jvmRoute you can give any name which should be unique for identification from other Application Servers.
Save the server.xml and restart the Apache Tomcat Service by following
# /usr/local/tomcat/bin/catalina.sh stop
# /usr/local/tomcat/bin/catalina.sh start
Go to Apache Server and under the /etc/httpd/conf folder create workers.properties file with the following content
# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list= applb, status
# App Server Tomcat1
worker.jvm1.port=8009
worker.jvm1.host=10.0.0.1
worker.jvm1.type=ajp13
worker.jvm1.lbfactor=10
worker.jvm1.distance=5
worker.jvm1.socket_timeout=60
worker.jvm1.connection_pool_timeout=1500
worker.jvm1.connect_timeout=60000
worker.jvm1.prepost_timeout=60000
# Load-balancing behaviour for Application Servers
worker.applb.type=lb
worker.applb.balance_workers=jvm1
worker.applb.lock=P
worker.applb.method=B
# Status worker for managing load balancer
worker.status.type=status
After that create uriworkermap.properties on the same folder (/etc/httpd/conf) as follows
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]
/jkstatus*=status
/ example*=applb
Assuming your application name is example
Ensure that the mod_jk.conf file is present in the apache conf folder and mod_jk.so file in the Apache modules folder.
Once it is done, restart apache by following
service httpd stop
service httpd start
Now you will be able to access as follows
http://172.16.0.1/example/index.jsp
From Tomcat Application Server for testing purpose (http://10.0.0.1:8080/example/index.jsp)
Similarly Apache - JBoss Connector
In adddition to all the changes made to Apache, the following modification is required in jboss server.xml under the default location (/opt/jboss-5.1.0.GA/server/default/deploy/jbossweb.sar) and edit the server.xml file as follows
and the following line
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="jvmJBoss">
and restart the JBoss as follows
./shutdown.sh -Djboss.bind.address=10.0.0.2 &
./run.sh -Djboss.bind.address=10.0.0.2 &
If you need any further information please on anything please mail us on globalinfodictionary@gmail.com Or use the comments section. Thanks a lot and hope this post helps you in configuring the same.
No comments:
Post a Comment