Configuration Apache for multiple wars on Tomcat with multipledomains

Configuration Apache for multiple wars on Tomcat with multipledomains

am 02.10.2009 17:15:53 von Cyril Vieville

--_000_A252D160BE252A4E816D21440EEC1B6B587581076Fstoms1lanlo ca_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I have an apache server used as load balancer for multiple tomcat servers c=
lusters with mod_jk.

The configuration is to have different workers on different servers and som=
etimes port as well :

#####
# START

# Nodes

JkWorkerProperty worker.server_1_1.host=3Dserver40
JkWorkerProperty worker.server_1_1.port=3D8009
JkWorkerProperty worker.server_1_1.reference=3Dworker.tmplt_worker

JkWorkerProperty worker.server_2_1.host=3Dserver41
JkWorkerProperty worker.server_2_1.port=3D8009
JkWorkerProperty worker.server_2_1.reference=3Dworker.tmplt_worker

# Loadbalancer

JkWorkerProperty worker.lb_cluster1.reference=3Dworker.tmplt_balancer
JkWorkerProperty worker.lb_cluster1.balance_workers=3Dserver_1_1,server_2_1

# END
#####

We use ServerAlias and our DNS registration (in direction of the apache ser=
ver of course) to have an URL by application. For this one, it=B4s cluster1=
..mydomain.com

Everything worked fine till today as we have a new need. We used to install=
only one war on each Tomcat server with the context path "" so the URL was=
http://cluster1.mydomain.com but now we have to host more than 1 war by to=
mcat server. So the Context path will change to the name of the war (no pro=
blem for that) but we don=B4t want to use

cluster1.mydomain.com/war1
cluster1.mydomain.com/war2

but

war1.mydomain.com
war2.mydomain.com

what should I do or add ? Is it on the Apache or mod_jk configuration, or o=
n the Tomcat side ?
Of course I need to add some ServerAlias lines but I don=B4t know what to d=
o with the rest ...

Thanks,

Cyril Vi=E9ville


--_000_A252D160BE252A4E816D21440EEC1B6B587581076Fstoms1lanlo ca_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

1">
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:p=3D"urn:schemas-m=
icrosoft-com:office:powerpoint" xmlns:a=3D"urn:schemas-microsoft-com:office=
:access" xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s=3D"=
uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs=3D"urn:schemas-microsof=
t-com:rowset" xmlns:z=3D"#RowsetSchema" xmlns:b=3D"urn:schemas-microsoft-co=
m:office:publisher" xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadshee=
t" xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" xmlns=
:odc=3D"urn:schemas-microsoft-com:office:odc" xmlns:oa=3D"urn:schemas-micro=
soft-com:office:activation" xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc=3D"http://m=
icrosoft.com/officenet/conferencing" xmlns:D=3D"DAV:" xmlns:Repl=3D"http://=
schemas.microsoft.com/repl/" xmlns:mt=3D"http://schemas.microsoft.com/share=
point/soap/meetings/" xmlns:x2=3D"http://schemas.microsoft.com/office/excel=
/2003/xml" xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" xmlns:ois=
=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir=3D"http://=
schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds=3D"http://www.w3=
..org/2000/09/xmldsig#" xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint=
/dsp" xmlns:udc=3D"http://schemas.microsoft.com/data/udc" xmlns:xsd=3D"http=
://www.w3.org/2001/XMLSchema" xmlns:sub=3D"http://schemas.microsoft.com/sha=
repoint/soap/2002/1/alerts/" xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#"=
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" xmlns:sps=3D"http://=
schemas.microsoft.com/sharepoint/soap/" xmlns:xsi=3D"http://www.w3.org/2001=
/XMLSchema-instance" xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/so=
ap" xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " xmlns:udc=
p2p=3D"http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf=3D"http:/=
/schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss=3D"http://sche=
mas.microsoft.com/office/2006/digsig-setup" xmlns:dssi=3D"http://schemas.mi=
crosoft.com/office/2006/digsig" xmlns:mdssi=3D"http://schemas.openxmlformat=
s.org/package/2006/digital-signature" xmlns:mver=3D"http://schemas.openxmlf=
ormats.org/markup-compatibility/2006" xmlns:m=3D"http://schemas.microsoft.c=
om/office/2004/12/omml" xmlns:mrels=3D"http://schemas.openxmlformats.org/pa=
ckage/2006/relationships" xmlns:spwp=3D"http://microsoft.com/sharepoint/web=
partpages" xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/20=
06/types" xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/200=
6/messages" xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ Sli=
deLibrary/" xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor tal=
Server/PublishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns:=
st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">












ans-serif";
color:#1F497D'>Hi,



ans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>I have an apache server used as load balancer for multiple
tomcat servers clusters with mod_jk.



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>The configuration is to have different workers on different
servers and sometimes port as well :



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>#####



ly:"Arial","sans-serif";
color:#1F497D'># START



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'># Nodes



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_1_1.host=3Dserver40 >



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_1_1.port=3D8009 pan>



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_1_1.reference=3Dworker.tmplt_=
worker



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_2_1.host=3Dserver41 >



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_2_1.port=3D8009 pan>



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty worker.server_2_1.reference=3Dworker.tmplt_=
worker



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'># Loadbalancer



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty
worker.lb_cluster1.reference=3Dworker.tmplt_balancer



ly:"Arial","sans-serif";
color:#1F497D'>JkWorkerProperty
worker.lb_cluster1.balance_workers=3Dserver_1_1,server_2_1 >



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'># END



ly:"Arial","sans-serif";
color:#1F497D'>#####



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>We use ServerAlias and our DNS registration (in direction of=
the
apache server of course) to have an URL by application. For this one, it=B4=
s
cluster1.mydomain.com



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>Everything worked fine till today as we have a new need. We =
used
to install only one war on each Tomcat server with the context path “=
” so the
URL was http://cluster1.mydomain.com but now we have to host more than 1 wa=
r by
tomcat server. So the Context path will change to the name of the war (no
problem for that)  but we don=B4t want to use



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>cluster1.mydomain.com/war1



ly:"Arial","sans-serif";
color:#1F497D'>cluster1.mydomain.com/war2



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>but



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>war1.mydomain.com



ly:"Arial","sans-serif";
color:#1F497D'>war2.mydomain.com



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>what should I do or add ? Is it on the Apache or mod_jk
configuration, or on the Tomcat side ?



ly:"Arial","sans-serif";
color:#1F497D'>Of course I need to add some ServerAlias lines but I don=B4t=
know
what to do with the rest ...



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>Thanks,



ly:"Arial","sans-serif";
color:#1F497D'> 



ly:"Arial","sans-serif";
color:#1F497D'>Cyril Vi=E9ville
:10.0pt;
font-family:"Times New Roman","serif";color:#1F497D'>



 









--_000_A252D160BE252A4E816D21440EEC1B6B587581076Fstoms1lanlo ca_--

Re: Configuration Apache for multiple wars on Tomcatwith multiple domains

am 02.10.2009 21:36:58 von Martin Spinassi

On Fri, 2009-10-02 at 17:15 +0200, Cyril Vieville wrote:
> Hi,
>
>
>
> I have an apache server used as load balancer for multiple tomcat
> servers clusters with mod_jk.

>
> We use ServerAlias and our DNS registration (in direction of the
> apache server of course) to have an URL by application. For this one,
> it´s cluster1.mydomain.com
>
>
>
> Everything worked fine till today as we have a new need. We used to
> install only one war on each Tomcat server with the context path “” so
> the URL was http://cluster1.mydomain.com but now we have to host more
> than 1 war by tomcat server. So the Context path will change to the
> name of the war (no problem for that) but we don´t want to use
>
>
>
> cluster1.mydomain.com/war1
>
> cluster1.mydomain.com/war2
>
>
>
> but
>
>
>
> war1.mydomain.com
>
> war2.mydomain.com
>
>
>
> what should I do or add ? Is it on the Apache or mod_jk configuration,
> or on the Tomcat side ?
>
> Of course I need to add some ServerAlias lines but I don´t know what
> to do with the rest ...
>
>
>
> Thanks,
>
>
>
> Cyril Viéville

Hello Cyril,

Take a look at virtual host on tomcat:
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howt o.html

I think that it is what you where searching for.

Also remember to have the right virtual host on apache to the right
worker.


Cheers,


Martin


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

RE: Configuration Apache for multiple wars on Tomcat with multipledomains

am 03.10.2009 17:33:44 von Cyril Vieville

--_000_A252D160BE252A4E816D21440EEC1B6B58758107A5stoms1lanlo ca_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

>Hello Cyril,

>Take a look at virtual host on tomcat:
>http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-how to.html

>I think that it is what you where searching for.

>Also remember to have the right virtual host on apache to the right
>worker.


>Cheers,


>Martin

Hello Martin,

Thank you for your answer. I can solve the multiple "/" context but my prob=
lem is how to connect an apache virtual host to a tomcat virtual host with =
mod_jk so ?
I can=B4t define the domain on Tomcat because our architecture is a Load Ba=
lancer providing queries to 2 apache servers that load balance after to a j=
boss (so tomcat webserver) cluster so the domain is defined on both of Apac=
he servers. It=B4s my real problem because maybe there is a way finally to =
connect an apache virtual host to a specific war on the tomcat server, no ?

So to make it simple, I want the visitor to go on http://war1.mydomain.com =
(the ip of mydomain.com is on the load balancer that will redirect to the a=
pache cluster that will redirect to the tomcat/jboss cluster thanks to mod_=
jk. The war application can be in a tomcat virtual host or not but I want t=
hat the visitor write http://war1.mydomain.com and not http://war1.mydomain=
..com/war1 ). i know it=B4s a complicated architecture but we want high avai=
lability of our applications.


--_000_A252D160BE252A4E816D21440EEC1B6B58758107A5stoms1lanlo ca_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:p=3D"urn:schemas-m=
icrosoft-com:office:powerpoint" xmlns:a=3D"urn:schemas-microsoft-com:office=
:access" xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s=3D"=
uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs=3D"urn:schemas-microsof=
t-com:rowset" xmlns:z=3D"#RowsetSchema" xmlns:b=3D"urn:schemas-microsoft-co=
m:office:publisher" xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadshee=
t" xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" xmlns=
:odc=3D"urn:schemas-microsoft-com:office:odc" xmlns:oa=3D"urn:schemas-micro=
soft-com:office:activation" xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc=3D"http://m=
icrosoft.com/officenet/conferencing" xmlns:D=3D"DAV:" xmlns:Repl=3D"http://=
schemas.microsoft.com/repl/" xmlns:mt=3D"http://schemas.microsoft.com/share=
point/soap/meetings/" xmlns:x2=3D"http://schemas.microsoft.com/office/excel=
/2003/xml" xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" xmlns:ois=
=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir=3D"http://=
schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds=3D"http://www.w3=
..org/2000/09/xmldsig#" xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint=
/dsp" xmlns:udc=3D"http://schemas.microsoft.com/data/udc" xmlns:xsd=3D"http=
://www.w3.org/2001/XMLSchema" xmlns:sub=3D"http://schemas.microsoft.com/sha=
repoint/soap/2002/1/alerts/" xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#"=
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" xmlns:sps=3D"http://=
schemas.microsoft.com/sharepoint/soap/" xmlns:xsi=3D"http://www.w3.org/2001=
/XMLSchema-instance" xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/so=
ap" xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " xmlns:udc=
p2p=3D"http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf=3D"http:/=
/schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss=3D"http://sche=
mas.microsoft.com/office/2006/digsig-setup" xmlns:dssi=3D"http://schemas.mi=
crosoft.com/office/2006/digsig" xmlns:mdssi=3D"http://schemas.openxmlformat=
s.org/package/2006/digital-signature" xmlns:mver=3D"http://schemas.openxmlf=
ormats.org/markup-compatibility/2006" xmlns:m=3D"http://schemas.microsoft.c=
om/office/2004/12/omml" xmlns:mrels=3D"http://schemas.openxmlformats.org/pa=
ckage/2006/relationships" xmlns:spwp=3D"http://microsoft.com/sharepoint/web=
partpages" xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/20=
06/types" xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/200=
6/messages" xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ Sli=
deLibrary/" xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor tal=
Server/PublishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns:=
st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">


>









ly:"Courier New"'>>Hello
Cyril,



ly:"Courier New"'> 



ly:"Courier New"'>>Take
a look at virtual host on tomcat:



ly:"Courier New"'>>http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosti=
ng-howto.html



ly:"Courier New"'> 



ly:"Courier New"'>>I
think that it is what you where searching for.



ly:"Courier New"'> 



ly:"Courier New"'>>Also
remember to have the right virtual host on apache to the right span>



ew"'>>worker.



ew"'> 



ew"'> 



ew"'>>Cheers,



ew"'> 



ew"'> 



ew"'>>Martin



ew"'> 



ew"'>Hello
Martin,



ew"'> 



ly:"Courier New"'>Thank
you for your answer. I can solve the multiple “/” context but m=
y
problem is how to connect an apache virtual host to a tomcat virtual host w=
ith
mod_jk so ?



ly:"Courier New"'>I
can=B4t define the domain on Tomcat because our architecture is a Load Bala=
ncer
providing queries to 2 apache servers that load balance after to a jboss (s=
o
tomcat webserver) cluster so the domain is defined on both of Apache server=
s.
It=B4s my real problem because maybe there is a way finally to connect an a=
pache
virtual host to a specific war on the tomcat server, no ?
=



ly:"Courier New"'> 



ly:"Courier New"'>So
to make it simple, I want the visitor to go on href=3D"http://war1.mydomain.com">http://war1.mydomain.com (the ip of
mydomain.com is on the load balancer that will redirect to the apache clust=
er
that will redirect to the tomcat/jboss cluster thanks to mod_jk. The war
application can be in a tomcat virtual host or not but I want that the visi=
tor
write and=
not href=3D"http://war1.mydomain.com/war1">http://war1.mydomain. com/war1 ).=
i
know it=B4s a complicated architecture but we want high availability of our
applications.   



ly:"Arial","sans-serif";
color:#1F497D'> 









--_000_A252D160BE252A4E816D21440EEC1B6B58758107A5stoms1lanlo ca_--