Apache default NameVirtualHost does not work

Posted by Luc on Server Fault See other posts from Server Fault or by Luc
Published on 2010-03-24T16:41:38Z Indexed on 2010/03/31 16:53 UTC
Read the original article Hit count: 660

Hello,

I have 4 Name Virtual Hosts on my apache configuration, each one using proxy_http to forward request to the correct server. They work fine.

<VirtualHost *:80>
ServerName application_name.domain.tld
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://server_ip/
ProxyPassReverse / http://server_ip/
</VirtualHost>

I then tried to add a default NameVirtualHost to take care of the requests for which the server name does not match one of the four others. Otherwise a request like some_weird_styff.domain.tld would be forwarded to one of the 4 VH.

I then added this one:

<VirtualHost *:80>
 ServerAlias "*"
 DocumentRoot /var/www/
</VirtualHost>

At the beginning it seemed to work fine, but at some point it appears that the requests that should be handed by one of the 4 regular hosts is "eaten" by the default one !!!

If I a2dissite this default host, everything is back to normal... I do not really understand this.

If you have any clue... thanks a lot, Luc

© Server Fault or respective owner

Related posts about apache

Related posts about configuration