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-unsubscr...@httpd.apache.org
" from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org