Installing Apache & Configuring Mod - JK (For Jboss Eap 6) : Verview
Installing Apache & Configuring Mod - JK (For Jboss Eap 6) : Verview
(ForJBossEAP6)
1 OVERVIEW
ApachewebservercanbeusedtofrontendtheJBossEAPcluster.Inordertosupportthiswe
needtoconfiguretousemod_jk.soconnectortoconnecttoJBossoverajpprotocol.This
modulereceivesalltheclientrequestandforwardsthemtoEAPcontainer.
PREREQUISITES
1Linuxoperatingsystemandthefollowingsoftware
apr1.5.1
pcre210.00
aprutil1.5.4
httpd2.4.12
tomcatconnectors1.2.40
Host:
176.223.60.173
Onthehostcreateadirectoryunder/asbelow[Thiswillvaryasspecifictotherequirement]
cd/
mkdirapachebinary
cd/apachebinary
ssh://[email protected]:7999/ap/apache_software.git
Note:Theaboveisthegitrepositoryurltodownloadallapachebinariesasshownbelow
3 APACHEINSTALLATION
Installapachebinaryasfollows
ApacheBinaryInstallationSteps
(a)Unzipthefollowingbinaries
cd/apachebinary/apache_software
unzipanduntarthefollowing
apr1.5.2.tar.gz
aprutil1.5.4.tar.gz
httpd2.2.31.tar.gz
(b)CompileAPRmodule.
cdapr1.5.1
./configure
make
makeinstall
cpRapr1.5.2/apachebinary/apache_software
cp/apachebinary/apache_software/https2.4.12/srclib
Note:Youmightencounteranerrorlike
rm:cannotremove`libtoolT':No
suchfileordirectory
Tofixthisjustedittheconfigurescriptwithbelowchanges
$RM"$cfgfile"
to
$RMf"$cfgfile"
(c)CompileAPRUtil
cdaprutil1.5.4
./configure
withapr=/apachebinary/apache_software/https2.4.12/srclib/apr1.5.2
make
makeinstall
(d)ComparePCRE
cdpcre210.00
./configureprefix=/usr/local/pcre
make
makeinstall
(e)InstallApacheBinary
./configureprefix=/opt/apache2.4.12withpcre=/usr/local/pcre
orcompilewithbelowoptionstocompileapache64Bitwithsupportfor
ssl,mod_rewrite,andproxy.
./configureprefix=/opt/apache2.4.12enablelib64libdir=/usr/lib64
enablerewriteenablesslenableproxyenableso
make
makeinstall
Belowconfigurationsareoptionalasneeded.
(f)InstallApacheConnector(mod_jk.so)
cdtomcatconnectors1.2.40src/native/
./configurewithapxs=/apache2.4.12/bin/apxs
withjavahome=/root/jdk1.6.0_45withprefix=/opt/apache2.4.12
make
makeinstall
Thisabovestepswillresultinthe/apachedirectorycreationandwillalsoinstallmod_jk.so
under/apache/module
Thiswillalsogeneratethemod_jkbasedproperties&configfilelike
httpdjk.conf
uriworkermap.properties
workers.properties
Somecasetheabovesetofcommandwontworktobuildthemod_jk.so,andyoumightsee
thefollowingerror
configure:WARNING:unrecognizedoptions:withjavahome,
withprefix
.Henceinthiscasepleasefollowthebelowsteps.
cdtomcatconnectors1.2.40src/native/
yumgroupinstall'DevelopmentTools'
./buildConf.sh
make
4 CONFIGUREAPACHEASFRONTENDFORJBOSSEAP6
Editthehttpd.conffiletohavefollowingchanges
EnableListenPort
Listen80
Includeexternalconfigdirectoryreferences
Includeconf.d/*.conf
Thesearetheminimumrequiredchanges.Othercustomizationcanbedonebasedon
requirement.
Nowwehavetoeditthemod_jkbasedpropertiesandconfigfile.
Edittheworkers.propertiesfiletoincludethefollowing
Add1stmemberstotheloadbalancer(Firstmemberisnode1)
worker.balancer.balance_workers=node1
worker.node1.reference=worker.template
worker.node1.host=192.168.121.130
worker.node1.port=8009(DefaultajpPort)
worker.node1.activation=A
worker.node1.ping_mode=A
worker.node1.lbfactor=1
worker.node1.type=ajp13
Add2ndmembertotheloadbalancer((Firstmemberisnode2)
worker.balancer.balance_workers=node2
worker.node2.reference=worker.template
worker.node2.host=192.168.121.128
worker.node2.port=8009
worker.node2.activation=A
worker.node2.ping_mode=A
worker.node2.lbfactor=1
worker.node2.type=ajp13
.(
youcanaddnodesasrequired
)
Belowpropertiesaredefaultandcanbetweakedifneeded
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.ping_mode=A
worker.template.ping_timeout=10000
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.reply_timeout=300000
worker.template.recovery_options=3
Thefollowingdefaultsaredefineduriworkermap.properties
/admin/*
=
lb
/manager/*
=
lb
/jspexamples/*
=
lb
/servletsexamples/*
=
lb
/examples/*
=
lb
/clusterTest/=lb
/jkmanager
=
jkstatus
Additionaleditcanbedoneasrequired.
Thefollowingentriesshouldbethereinhttpdjk.conf
LoadModulejk_modulemodules/mod_jk.so
<IfModulejk_module>
#Weneedaworkersfileexactlyonce
#andintheglobalserver
JkWorkersFileconf/workers.properties
#OurJKerrorlog
#Youcan(andshould)userotatelogshere
JkLogFilelogs/mod_jk.log
#OurJKloglevel(trace,debug,info,warn,error)
JkLogLevelinfo
#OurJKsharedmemoryfile
JkShmFilelogs/mod_jk.shm
<Location/jkstatus>
#InsideLocationwecanomittheURLinJkMount
JkMountjkstatus
Orderdeny,allow
Denyfromall
Allowfrom127.0.0.1
</Location>
<Location/jkmanager>
#InsideLocationwecanomittheURLinJkMount
JkMountjkmanager
Orderdeny,allow
Denyfromall
Allowfrom127.0.0.1
</Location>
Additionaleditcanbedoneasrequired.
5 STARTINGAPACHEWEBSERVER&TESTINGAPP
StartingApache
cd/apache/bin
./apachectlstart
.
httpdnotrunning,tryingtostart
apache2.2startedOK!
OnBrowsertry
http://
176.223.60.173
:80
shoulddisplay
6 DEPLOYINGAPPLICATIONONJBOSSSIDE
DeployanapplicationontoJBossCluster.Ideployedanapplicationcalled
clusterTest.war
on
toservergroup
NowaccesstheapplicationfromApachewebserver
http://
176.223.60.173
:80/clusterTest
IfserverTest01isshutdownweshouldseetherequestfailovertoTest02