httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathijs <mathijs...@gmail.com>
Subject Re: [users@httpd] Need Help Configuring Virtual Hosts With DNS Aliases
Date Wed, 02 Jan 2013 23:46:26 GMT
Hi Kris,

On Wed, Jan 2, 2013 at 10:11 PM, Wempa, Kristofer
<Kristofer.Wempa@sig.com>wrote:

>
> I'm trying to do something slightly different than is described in the
> Apache documentation that I've read.  We have an internal Linux server that
> uses Apache as a load-balancer + URL redirector to a Redmine instance
> running a Thin web server on localhost ports 3000-3002.  We have a
> "redmine" alias that we are load balancing among these 3 ports with the
> following VirtualHost entry:
>
>         <VirtualHost *>
>
>         ServerAdmin    devtoolsandcomponents@msx.bala.susq.com
>         ServerName     sdlcdevbal832
>         ServerAlias    redmine
>
>         RewriteEngine On
>
>         # Redirect all non-static requests to cluster
>         RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
>         RewriteRule ^/(.*)$ balancer://redminecluster%{REQUEST_URI}
> [P,QSA,L]
>
>         </VirtualHost>
>
>         <Proxy balancer://redminecluster>
>                 BalancerMember http://127.0.0.1:3000
>                 BalancerMember http://127.0.0.1:3001
>                 BalancerMember http://127.0.0.1:3002
>         </Proxy>
>
> However, we also have a separate test Redmine instance running on port
> 4000.  We created a "redminetest" alias and we want all URLs that start
> with "http://redminetest" to be redirected to port 4000 (no load
> balancing) while URLs that start with "http://redmine" to continue to be
> load-balanced on ports 3000-3002.  We created the following additional
> VirtualHost entry:
>
>         <VirtualHost *>
>
>         ServerAdmin    devtoolsandcomponents@msx.bala.susq.com
>         ServerName     sdlcdevbal832
>         ServerAlias    redminetest
>
>         RewriteEngine On
>
>         # Redirect all non-static requests to cluster
>         RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
>         RewriteRule ^/(.*)$ balancer://redminetestcluster%{REQUEST_URI}
> [P,QSA,L]
>
>         </VirtualHost>
>
>         <Proxy balancer://redminetestcluster>
>                 BalancerMember http://127.0.0.1:4000
>         </Proxy>
>
> Unfortunately, this did not work.  It resulted in URLs with both the
> "redmine" and "redminetest" aliases being sent to the load-balanced
> production instance.  Can somebody explain what we are doing wrong ?  The
> Apache documentation isn't clear about how the server matches VirtualHost
> entries and we've obviously done something wrong.  Any help would be
> greatly appreciated.  Thanks.
>


The ServerAlias directive does not have an implicit wildcard, meaning that
'ServerAlias redminetest' will not match the 'Host: redminetestcluster'
header. Since no virtualhost is specified for the host redminetestcluster,
Apache HTTPD will pick the default virtualhost for handling the request
which is always the first virtualhost defined.

To solve your problem you should change your ServerAlias so it will match
any Host starting with 'redminetest': ServerAlias redminetest*


Kind regards,

Mathijs Schmittmann



>
>         Kris
>
>
> ________________________________
>
> IMPORTANT: The information contained in this email and/or its attachments
> is confidential. If you are not the intended recipient, please notify the
> sender immediately by reply and immediately delete this message and all its
> attachments. Any review, use, reproduction, disclosure or dissemination of
> this message or any attachment by an unintended recipient is strictly
> prohibited. Neither this message nor any attachment is intended as or
> should be construed as an offer, solicitation or recommendation to buy or
> sell any security or other financial instrument. Neither the sender, his or
> her employer nor any of their respective affiliates makes any warranties as
> to the completeness or accuracy of any of the information contained herein
> or that this message or any of its attachments is free of viruses.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

Mime
View raw message