httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Cicimov <>
Subject Re: [users@httpd] Struggling with Reverse Proxy Configuration for Server with multiple subdomains
Date Fri, 15 Mar 2013 12:49:23 GMT
On Fri, Mar 15, 2013 at 3:15 AM, Ryan Merrell <> wrote:

> Our web application (an LMS) uses three subdomains to serve its content:
> These are all vhosts running off of 1 server. My end goal is to use
> mod_proxy as a reverse proxy and to load balance between two servers.
> Until we can make changes to the app to be more tolerant to HA
> systems, the load balancer will most likely need to be Active/Passive
> between two back end servers.
> I'm new to mod_proxy, so I've started off with just trying to set up a
> 1:1 reverse proxy, meaning one proxy server sending all traffic to one
> server only. But I can't seem to get that working. Every example I can
> find for setting up a reverse proxy uses examples like
> "$FUNCTION" as the public side and "$'
> as the private.


> For example, on the proxy goes
> to on the private side. on
> the proxy goes to on the private side. I can't do
> this without considerable changes to how our application works. What i
> need is for on the proxy to go to on
> the back end. Same for shared and training.
> On the proxy I tried configuring 3 vhosts (,
>, and An example is like the
> following:(proxy is and host 1 is
> NameVirtualHost
> <VirtualHost>
> ServerName
> <IfModule mod_proxy.c>
> ProxyRequests Off
> ProxyPreserveHost On
> ProxyPass /
> ProxyPassReverse /
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
> </IfModule>
> </VirtualHost>
> I have the same thing for training and shared as well. Then on the
> backend server, I have a standard vhost configuration for the three
> vhosts (meaning if I change my dns to resolve to, the
> web page functions as expected).

When you go to, how do you access each of the
applications? Meaning what is the direct url you will be using? In your
current set-up there isn't any right? So how are you going to distinguish
to which backend application you are going to send a specific request?

> With this set up, and my DNS resolving to the proxy for all three
> subdomains, I can pull up the few items that loads from "home", but
> anything being requested from shared (training isn't used on the login
> screen) gets a 404. When I look at the backend server looks, the 404
> is looking in home's document root instead of Shared. So it seems that
> all requests being passed to the back end server are going to the
> default vhost and not based off of the Host name.Everything I can find
> regarding this type of error have lead to making sure the
> NameVirtualHost and VirtualHost directives match, which they do and it
> still seems to go to the first vhost listed.
> So a couple questions I have are
> 1) Is what I'm planning to accomplish even doable? I figured if it was
> I'd at least be able to find just one example out on the Internet, but
> I haven't been able to, which has created doubt as to whether I'm
> fully understanding how mod_proxy works.
> 2) If it is doable, what config changes do I need to make so it uses
> the hostname instead of the default vhost?
> 3) If I can get this part to work, am I going to have any problems in
> getting an Active/Passive load balancer set up?

You need to host the domains on the frontend apache and forward the
requests to the backend application, but you can't host it on both frontend
and backend as you are doing. Example:

<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On

ProxyPass /
ProxyPassReverse /

<Proxy *>
Order deny,allow
Allow from all


Then on the backend server you'll have:

NameVirtualHost <>
<VirtualHost <>>
    ServerName <call_it_whatever_you_want>
    DocumentRoot <your_document_root>/home/
<VirtualHost <>>
    ServerName <call_it_whatever_you_want>
    DocumentRoot <your_document_root>/training/
<VirtualHost <>>
    ServerName <call_it_whatever_you_want>
    DocumentRoot <your_document_root>/shared/

and put the home application files under <your_document_root>/home/, where
<your_document_root> for most of the linux's would be /var/www.

> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message