Re: alias using Virtual host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Melanie Pfefer wrote:
Hi.

thanks for the clarification.
What do you propose as a solution so that I have an alias that redirects then to a specified port?


I thought I already did, below.
Look at the config lines I inserted.
Doesn't that work ?


thank you in advance.

--- On Mon, 27/4/09, André Warnier <aw@xxxxxxxxxx> wrote:

From: André Warnier <aw@xxxxxxxxxx>
Subject: Re:  alias using Virtual host
To: users@xxxxxxxxxxxxxxxx
Date: Monday, 27 April, 2009, 4:50 PM
Melanie Pfefer wrote:
Hi

I have the main apache running on port 80.
I built another configuration file to have another
apache running on port 8094.
I can access both servers:

http://host
http://host:8094

Now I want to have http://MySecondAlias to redirect to http://host:8094

I added MySecondAlias to DNS and I added these lines
in the main apache config
Listen 80
Listen 8084

NameVirtualHost *:80

<VirtualHost *:80>
         ServerName
localhost
    ....
</VirtualHost>
<VirtualHost *:80>
         ServerName
MySecondAlias
         ProxyPass / http://localhost:8094/
         ProxyPassReverse
/ http://localhost:8094/
</VirtualHost>
NameVirtualHost *:8084

<VirtualHost *:8084>
         ServerName
localhost
    ....
</VirtualHost>
Explanation:
For each listen port, the first-defined VirtualHost section
acts as the "default host".  That means that whenever
Apache receives a request on that port, and the hostname of
that request does not match any of the ServerName directives
of the <VirtualHost> sections for that port, it will
use the first <VirtualHost> section to answer the
request.
(So basically, for that first <VirtualHost> section,
it does not matter which ServerName you put in it).
In other words, if your section
<VirtualHost *:80>
        ServerName MySecondAlias
        ProxyPass / http://localhost:8094/
        ProxyPassReverse / http://localhost:8094/
</VirtualHost>
was the only one, then it was also the default one, and it
was catching *all* the requests (no matter if they said
"host" or "www.google.com" or "MySecondAlias" or whatever).

Another tidbit : you mentioned "a 2d Apache"
somewhere.  There is only *one* Apache, with children
(or threads) all identical.  The "parent" Apache only
catches incoming connections, and distributes them to
whatever child happens to be inactive.  Each child can
answer any request, to any VirtualHost.  It just
temporarily "takes the personality" of the selected
VirtualHost to answer that request.
When it's done with that request, it becomes neutral again,
and can answer next any request for any VirtualHost again.

To use an image, think of it as one "father Apache" who
just distributes the work among his 20 "twin children
Apache", all of them who are very good actors, and can
temporarily impersonate any VirtualHost, for just one
request.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP
Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more
info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux