You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Cyril Vieville <Cy...@ebuilder.se> on 2009/10/02 17:15:53 UTC

[users@httpd] Configuration Apache for multiple wars on Tomcat with multiple domains

Hi,

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

The configuration is to have different workers on different servers and sometimes port as well :

#####
# START

# Nodes

JkWorkerProperty worker.server_1_1.host=server40
JkWorkerProperty worker.server_1_1.port=8009
JkWorkerProperty worker.server_1_1.reference=worker.tmplt_worker

JkWorkerProperty worker.server_2_1.host=server41
JkWorkerProperty worker.server_2_1.port=8009
JkWorkerProperty worker.server_2_1.reference=worker.tmplt_worker

# Loadbalancer

JkWorkerProperty worker.lb_cluster1.reference=worker.tmplt_balancer
JkWorkerProperty worker.lb_cluster1.balance_workers=server_1_1,server_2_1

# END
#####

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


Re: [users@httpd] Configuration Apache for multiple wars on Tomcat with multiple domains

Posted by Martin Spinassi <ma...@gmail.com>.
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.
<snip>
> 
> 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-howto.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 <URL:http://httpd.apache.org/userslist.html> 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


[users@httpd] RE: Configuration Apache for multiple wars on Tomcat with multiple domains

Posted by Cyril Vieville <Cy...@ebuilder.se>.
>Hello Cyril,

>Take a look at virtual host on tomcat:
>http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.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 problem is how to connect an apache virtual host to a tomcat virtual host with mod_jk so ?
I can´t define the domain on Tomcat because our architecture is a Load Balancer providing queries to 2 apache servers that load balance after to a jboss (so tomcat webserver) cluster so the domain is defined on both of Apache servers. It´s 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 apache 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 that the visitor write http://war1.mydomain.com and not http://war1.mydomain.com/war1 ). i know it´s a complicated architecture but we want high availability of our applications.