httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mark (at) edgewire" <m...@edgewire.sg>
Subject Re: [users@httpd] how do I *define* a default virtual host
Date Tue, 15 Sep 2009 07:09:02 GMT
Hi Robert,

 From the documentation, it does seem like you can't define a default  
virtual host but what you can do is to add it into the top entry of  
your list of virtual hosts to have it serve up that page when there  
are no matching virtual hosts.

 From the documentation, http://httpd.apache.org/docs/2.0/vhosts/name-based.html

Now when a request arrives, the server will first check if it is using  
an IP address that matches the NameVirtualHost. If it is, then it will  
look at each <VirtualHost> section with a matching IP address and try  
to find one where the ServerName or ServerAlias matches the requested  
hostname. If it finds one, then it uses the configuration for that  
server. If no matching virtual host is found, then the first listed  
virtual host that matches the IP address will be used.

As a consequence, the first listed virtual host is the default virtual  
host. The DocumentRoot from the main server will never be used when an  
IP address matches the NameVirtualHost directive. If you would like to  
have a special configuration for requests that do not match any  
particular virtual host, simply put that configuration in a  
<VirtualHost> container and list it first in the configuration file.

Hope that helped.

Best regards,

Mark


On 15-Sep-2009, at 3:02 PM, robert rottermann wrote:

> hi ther,
> I load my VH's from a directory with a number of VH's
>
> is it possible to define which one is the default one?
>
> it seems to select the first in alphabetical order.
>
> thanks
> robert
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


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


Mime
View raw message