You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by LuKreme <kr...@kreme.com> on 2009/09/15 16:50:56 UTC
[users@httpd] Re: how do I *define* a default virtual host
On 15-Sep-2009, at 01:54, Krist van Besien wrote:
> On Tue, Sep 15, 2009 at 9:02 AM, robert rottermann
> <ro...@redcor.ch> 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.
>
> I asume you have one config that pulls in the VH's configs via an
> include statement. Something like:
>
> Include /etc/httpd/vhosts/*.conf
>
> In that case they are indeed loaded in alphabetical order, as that is
> the way the OS sorts files by default.
I always put my default VirtualHost directly into the httpd.conf file,
just before the Include line.
This way there is no question about which directive is the default,
and I am not dependent on filename order.
--
Dinosaurs are attacking! Throw a barrel!
---------------------------------------------------------------------
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
[users@httpd] Re: how do I *define* a default virtual host
Posted by LuKreme <kr...@kreme.com>.
On 16-Sep-2009, at 08:22, Eric Covener wrote:
> On Wed, Sep 16, 2009 at 10:02 AM, LuKreme <kr...@kreme.com> wrote:
>> OTOH, _default_ is dangerous, and you have to be sure that it is
>> the LAST
>> directive as it stomps everything that follows it.
>
> Whether it comes first or last, it never "covers up" a VirtualHost
> with a specific (and matching) IP address.
"The default vhost for port 80 (which must appear before any default
vhost with a wildcard port) catches all requests that were sent to an
unspecified IP address. The main server is never used to serve a
request."
The parenthetical certainly gives the impression that a _default_
stomps on following directives, but I've never tested that. Rereading
it, I can see that it could easily not imply what I thought it implied.
--
Overhead, without any fuss, the stars were going out.
---------------------------------------------------------------------
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
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by Eric Covener <co...@gmail.com>.
On Wed, Sep 16, 2009 at 10:02 AM, LuKreme <kr...@kreme.com> wrote:
> OTOH, _default_ is dangerous, and you have to be sure that it is the LAST
> directive as it stomps everything that follows it.
Whether it comes first or last, it never "covers up" a VirtualHost
with a specific (and matching) IP address.
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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
[users@httpd] Re: how do I *define* a default virtual host
Posted by LuKreme <kr...@kreme.com>.
On 16-Sep-2009, at 07:17, Geurts, G.P.T.M. wrote:
Hello,
> Thanks for your reply!
> I don't think it whould work for us.... we use ip based virtual
> hosting
> so a virtualhost directive looks like <VitualHost 1.2.3.4:80>
> What does the __default__ directive do anyways?
_default_ is useful. Say you have 20 IPs on a single machine, and 12
of those are assigned to various domains, but the other 8 are not.
Then you could have a _default_ directive AFTER all the other
virtualhost directives, so that any IP address not previously set to a
specific location would go to, say, your ecommerce page.
<http://httpd.apache.org/docs/2.0/vhosts/examples.html>
_default_ vhosts for all ports
Catching every request to any unspecified IP address and port, i.e.,
an address/port combination that is not used for any other virtual host.
Server configuration
<VirtualHost _default_:*>
DocumentRoot /www/default
</VirtualHost>
Using such a default vhost with a wildcard port effectively prevents
any request going to the main server.
A default vhost never serves a request that was sent to an address/
port that is used for name-based vhosts. If the request contained an
unknown or no Host: header it is always served from the primary name-
based vhost (the vhost for that address/port appearing first in the
configuration file).
OTOH, _default_ is dangerous, and you have to be sure that it is the
LAST directive as it stomps everything that follows it.
--
"Why do you wear that stupid bunny suit?" "Why are you wearing that
stupid man suit?"
---------------------------------------------------------------------
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
RE: [users@httpd] Re: how do I *define* a default virtual host
Posted by "Geurts, G.P.T.M." <g....@i-groep.leidenuniv.nl>.
Hello,
Thanks for your reply!
I don't think it whould work for us.... we use ip based virtual hosting
so a virtualhost directive looks like <VitualHost 1.2.3.4:80>
What does the __default__ directive do anyways?
Greetings,
Geert
________________________________
From: Igor Cicimov [mailto:icicimov@gmail.com]
Sent: woensdag 16 september 2009 15:12
To: users@httpd.apache.org
Subject: Re: [users@httpd] Re: how do I *define* a default virtual host
What about defining the default VH by using the _default_ expression.
Like this
<VirtualHost _default_:80>
ServerName
ServerAlias
.
.
.
</VirtualHost>
On Wed, Sep 16, 2009 at 7:26 PM, Jan G.B. <ro...@googlemail.com>
wrote:
2009/9/15 LuKreme <kr...@kreme.com>
On 15-Sep-2009, at 09:34, Jan G.B. wrote:
2009/9/15 LuKreme <kr...@kreme.com>
I always put my default VirtualHost
directly into the httpd.conf file, just
before the Include line.
I'd say this way it's always unclear which is
the default vhost. As you
have to dig through <config_file> instead of
just issuing a `cat
/etc/apache2/sites-enabled/*` or just `ls`.
apachectl -S
As the example shows, there's also no easy way
of disabling the vhost
on-the-fly (ie: rm <symlink>). ;-)
I've never needed to disabled vhosts completely like
that.
However, I thought if you had NameVirtualHost set and
had no Vhosts directives that was an error in configuration.
Great, thanks. I never noticed the show switch '-S'. That's
handy.
For disabling vhosts: it happens from time to time, when you
administer several sites with different mandants, white label stuff and
alike....
Regards
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by Eric Covener <co...@gmail.com>.
On Wed, Sep 16, 2009 at 9:12 AM, Igor Cicimov <ic...@gmail.com> wrote:
> What about defining the default VH by using the _default_ expression. Like
> this
>
> <VirtualHost _default_:80>
> ServerName
> ServerAlias
> .
> .
> .
> </VirtualHost>
That doesn't make this particular virtualhost the default virtual
host for a set of name-based virtual hosts.
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by Igor Cicimov <ic...@gmail.com>.
What about defining the default VH by using the _default_ expression. Like
this
<VirtualHost _default_:80>
ServerName
ServerAlias
.
.
.
</VirtualHost>
On Wed, Sep 16, 2009 at 7:26 PM, Jan G.B. <ro...@googlemail.com> wrote:
>
>
> 2009/9/15 LuKreme <kr...@kreme.com>
>
>> On 15-Sep-2009, at 09:34, Jan G.B. wrote:
>>
>>> 2009/9/15 LuKreme <kr...@kreme.com>
>>>
>>>> I always put my default VirtualHost directly into the httpd.conf file,
>>>> just
>>>> before the Include line.
>>>>
>>>>
>> I'd say this way it's always unclear which is the default vhost. As you
>>> have to dig through <config_file> instead of just issuing a `cat
>>> /etc/apache2/sites-enabled/*` or just `ls`.
>>>
>>
>> apachectl -S
>>
>> As the example shows, there's also no easy way of disabling the vhost
>>> on-the-fly (ie: rm <symlink>). ;-)
>>>
>>
>> I've never needed to disabled vhosts completely like that.
>>
>> However, I thought if you had NameVirtualHost set and had no Vhosts
>> directives that was an error in configuration.
>>
>>
>> Great, thanks. I never noticed the show switch '-S'. That's handy.
>
> For disabling vhosts: it happens from time to time, when you administer
> several sites with different mandants, white label stuff and alike....
>
> Regards
>
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by "Jan G.B." <ro...@googlemail.com>.
2009/9/15 LuKreme <kr...@kreme.com>
> On 15-Sep-2009, at 09:34, Jan G.B. wrote:
>
>> 2009/9/15 LuKreme <kr...@kreme.com>
>>
>>> I always put my default VirtualHost directly into the httpd.conf file,
>>> just
>>> before the Include line.
>>>
>>>
> I'd say this way it's always unclear which is the default vhost. As you
>> have to dig through <config_file> instead of just issuing a `cat
>> /etc/apache2/sites-enabled/*` or just `ls`.
>>
>
> apachectl -S
>
> As the example shows, there's also no easy way of disabling the vhost
>> on-the-fly (ie: rm <symlink>). ;-)
>>
>
> I've never needed to disabled vhosts completely like that.
>
> However, I thought if you had NameVirtualHost set and had no Vhosts
> directives that was an error in configuration.
>
>
> Great, thanks. I never noticed the show switch '-S'. That's handy.
For disabling vhosts: it happens from time to time, when you administer
several sites with different mandants, white label stuff and alike....
Regards
[users@httpd] Re: how do I *define* a default virtual host
Posted by LuKreme <kr...@kreme.com>.
On 15-Sep-2009, at 09:34, Jan G.B. wrote:
> 2009/9/15 LuKreme <kr...@kreme.com>
>> I always put my default VirtualHost directly into the httpd.conf
>> file, just
>> before the Include line.
>>
> I'd say this way it's always unclear which is the default vhost. As
> you
> have to dig through <config_file> instead of just issuing a `cat
> /etc/apache2/sites-enabled/*` or just `ls`.
apachectl -S
> As the example shows, there's also no easy way of disabling the vhost
> on-the-fly (ie: rm <symlink>). ;-)
I've never needed to disabled vhosts completely like that.
However, I thought if you had NameVirtualHost set and had no Vhosts
directives that was an error in configuration.
--
Women and cats will do as they please, and men and dogs should
relax an get used to the idea.
---------------------------------------------------------------------
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
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by Eric Covener <co...@gmail.com>.
On Tue, Sep 15, 2009 at 11:34 AM, Jan G.B. <ro...@googlemail.com> wrote:
> I'd say this way it's always unclear which is the default vhost. As you have
> to dig through <config_file> instead of just issuing a `cat
> /etc/apache2/sites-enabled/*` or just `ls`.
apachectl/apache2ctl/httpd -S ?
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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
Re: [users@httpd] Re: how do I *define* a default virtual host
Posted by "Jan G.B." <ro...@googlemail.com>.
2009/9/15 LuKreme <kr...@kreme.com>
> On 15-Sep-2009, at 01:54, Krist van Besien wrote:
>
>> On Tue, Sep 15, 2009 at 9:02 AM, robert rottermann <ro...@redcor.ch>
>> 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.
>>>
>>
>> I asume you have one config that pulls in the VH's configs via an
>> include statement. Something like:
>>
>> Include /etc/httpd/vhosts/*.conf
>>
>> In that case they are indeed loaded in alphabetical order, as that is
>> the way the OS sorts files by default.
>>
>
> I always put my default VirtualHost directly into the httpd.conf file, just
> before the Include line.
>
> This way there is no question about which directive is the default, and I
> am not dependent on filename order.
>
>
> I'd say this way it's always unclear which is the default vhost. As you
have to dig through <config_file> instead of just issuing a `cat
/etc/apache2/sites-enabled/*` or just `ls`.
As the example shows, there's also no easy way of disabling the vhost
on-the-fly (ie: rm <symlink>). ;-)
Regards.