Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Chain 2 virtual hosts using ProxyPass and ProxyPassReverse |
|
Author |
|
jnsunkersett
Joined: 30 Jan 2011 Posts: 23
|
Posted: Tue 20 Mar '12 19:52 Post subject: Chain 2 virtual hosts using ProxyPass and ProxyPassReverse |
|
|
Hi,
Is is possible to chain 2 virtual hosts using ProxyPass and ProxyPassReverse directives?
I want to direct traffic based on URI - the user should not be required to know the port number of the VH.
To elaborate;
I have an Apache server httpd, ver 2.2.17 in which I have defined 2 virtual host.
<VirtualHost *:80>
JkMount /* loadBalancer-R1
</VirtualHost>
<VirtualHost *:90>
JkMount /* loadBalancer-R2
</VirtualHost>
Then using mod_jk + ajp13 + worker.properties, established a Apache front end for 2 instances of my Tomcat server.
loadBalancer-R1, routes requests to Tomcat-instance-1
loadBalancer-R2, routes requests to Tomcat-instance-2
But for that in the browser I need to type
http://serverName:PORT/uri .... port 80 is picked by default but if it is port 90, I need to explicitly specify it.
I would like to use only the default port and have a URI, like /relaease2 instead,
where http://serverName/release2 takes user to http://serverName:90/uri
and
where http://serverName/release1 takes user to http://serverName:80/uri
I tried to use ProxyPass and ProxyPassReverse directives but did not succeed in redirecting traffic as per the URI.
Your clues/ workarounds, will be greatly appreciated.
thank you.
Jeevan
PS: I was referring to James reply when trying ProxyPass and ProxyPassReverse
http://www.apachelounge.com/viewtopic.php?t=4455&highlight= |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 21 Mar '12 15:04 Post subject: Re: Chain 2 virtual hosts using ProxyPass and ProxyPassRever |
|
|
Why not using a single vhost on port 80 and out your mod jk stuff into a Location container? I've done that with the on board proxy stuff.
I've not mod_jk, but my setup would be something like
Code: |
VirtualHost *:80>
ServerName localhost
DocumentRoot "/Apache23/htdocs"
<Directory "/Apache23/htdocs">
Options Indexes FollowSymLinks Includes
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
<Location /release1>
JkMount /* loadBalancer-R1
</Location>
<Location /release2>
JkMount /* loadBalancer-R2
</Location>
</VirtualHost>
|
Since I don't have mod jk, but some jenkins I use the mod_proxy_ajp stuff. That would be:
Code: |
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Apache23/htdocs"
<Directory "/Apache23/htdocs">
Options Indexes FollowSymLinks Includes
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
<Location /release1>
ProxyPass balancer://hotcluster1/
<Proxy balancer://hotcluster1>
BalancerMember ajp://1.2.3.4:8009 loadfactor=1
BalancerMember ajp://1.2.3.5:8009 loadfactor=2
# The below is the hot standby
BalancerMember ajp://1.2.3.6:8009 status=+H
ProxySet lbmethod=bytraffic
</Proxy>
</Location>
<Location /release2>
ProxyPass balancer://hotcluster2/
<Proxy balancer://hotcluster2>
BalancerMember ajp://1.2.3.4:8099 loadfactor=1
BalancerMember ajp://1.2.3.5:8099 loadfactor=2
# The below is the hot standby
BalancerMember ajp://1.2.3.6:8099 status=+H
ProxySet lbmethod=bytraffic
</Proxy>
</Location>
</VirtualHost>
|
|
|
Back to top |
|
|
|
|
|
|