Configure Apache:virtual host, mod_proxy and mod_proxy_ajp

Icon from Nuvola icon theme for KDE 3.x.

Image via Wikipedia

Once you configured your java application server and apache everything is fine until you want to host your another domain at the same server.

I assume that you have configured your apache server: Complete Apache 2.2-AJP Load Balance via mod_proxy

If you have succeed  this configuration, I hope so :) add your virtual host configuration:

NameVirtualHost www.mystaticdomain.com:80
NameVirtualHost www.myjspdomain.com:80

and add new configuration command around previous ajp conf:

<VirtualHost www.myjspdomain.com:80>
ServerName www.myjspdomain.com

<Location /balancer-manager>
SetHandler balancer-manager
</Location>

<Proxy balancer://ajpCluster>
BalancerMember ajp://localhost:8009 route=s1
BalancerMember ajp://localhost:9009 route=s2
BalancerMember ajp://localhost:7009 route=s3
</Proxy>
<Location /jspapp1>
ProxyPass balancer://ajpCluster/jspapp1 stickysession=JSESSIONID
</Location>
<Location /jspapp2>
ProxyPass balancer://ajpCluster/jspapp2 stickysession=JSESSIONID

</Location>

</VirtualHost>

and you have ajp proxy cluster and virtual host configuration for apache 2.2 at the same time.

Related Posts

  1. Complete Apache 2.2-AJP Load Balance via mod_proxy
  2. multiple tomcat instance – single setup
  3. tomcat port configuration
  4. URI Encoding for tomcat 5.5.X
  1. This is great – thanks for the articles. Do you know how you would host two different web apps on Tomcat for two different domains?

  1. No trackbacks yet.