Fronting two tomcat Servers with Apache HTTP server

I am trying to host the two different context (on 2 different tomcat servers) under the same domain. The contexts are related and should be hosted under same domain name. Lets say http://test.com/test1 and http://test.com/test2.

The apache http server already routing the internet traffic to http://test.com/test1 using the below configuration.

<VirtualHost *:80 *:443>
   ServerName test.com
   ProxyRequests Off
<Proxy balancer://test1Bal>
   BalancerMember ajp://tomcat1_host:8009/tomcat1
</Proxy>
    ProxyPass /test1/ balancer://test1Bal/
    ProxyPass / balancer://test1Bal/    
</VirtualHost> 

Is there any way if i hit the URL http://test.com/test2, the apache http server should serve the pages/requests from the tomcat2 server ?

Thank you very much!

Answers


With a only a single node, you can remove the balancer. You also don't need the ProxyPass line that is redirecting /.

Use the following configuration.

<VirtualHost *:80 *:443>
   ServerName test.com
   ProxyRequests Off
   ProxyPass /test1/ ajp://tomcat1_host:8009/tomcat1
   ProxyPass /test2/ ajp://tomcat2_host:8009/tomcat2
</VirtualHost> 

Need Your Help

Grails - Where to store properties related to domains

arrays grails

This is something I have been struggling about for some time now. The thing is: I have many (20 or so) static arrays of values. I say static because that is how I'm actually storing them, as static

Automate `svn up` with password entry

python svn pexpect

I need a script that updates my copy of a repository. When I type "svn up" I usually am forced to enter a password, how do I automate the password entry?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.