You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Redalert Commander <re...@gmail.com> on 2013/10/01 16:02:10 UTC
[users@httpd] Name based virtualhosts with default
Hi,
I was reading the documentation and testing out some things.
We have multiple name based virtual hosts, but would like to display a
page when not match is found.
According to the documentation at [1] and [2], the first matching
servername or alias is used, with no precedence for wildcards.
What appears to be working in our case is a 'default' host with
'ServerName *', but how would I know for certain that this is the one
that is always used?
Our configuration has the typical include of
"/etc/httpd/conf.d/*.conf", it is here that the vhosts are defined in
separate files. Should the default also be placed in here or does it
have to be defined at the end of the httpd.conf (master) configuration
file?
It is currently my understanding that I should place it at the bottom
of httpd.conf; so to be sure it is that last that is matched, but I
would like to hear from someone with more knowledge and/or experience
about apache than myself.
I would prefer it to be placed in the conf.d folder if possible.
Best regards,
Steven
[1] http://httpd.apache.org/docs/2.2/vhosts/name-based.html
[2] https://httpd.apache.org/docs/2.4/vhosts/name-based.html#defaultvhost
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Name based virtualhosts with default
Posted by Redalert Commander <re...@gmail.com>.
2013/10/1 Yehuda Katz <ye...@ymkatz.net>:
> On Tue, Oct 1, 2013 at 10:02 AM, Redalert Commander
> <re...@gmail.com> wrote:
>>
>> Our configuration has the typical include of
>> "/etc/httpd/conf.d/*.conf", it is here that the vhosts are defined in
>> separate files. Should the default also be placed in here or does it
>> have to be defined at the end of the httpd.conf (master) configuration
>> file?
>>
>> It is currently my understanding that I should place it at the bottom
>> of httpd.conf; so to be sure it is that last that is matched, but I
>> would like to hear from someone with more knowledge and/or experience
>> about apache than myself.
>> I would prefer it to be placed in the conf.d folder if possible.
>
>
> It might depend on which distribution you are using.
> Some systems (Debian, for example) will always load the config files in
> alphabetical order, so the efault vhost is usually named 000-default to
> ensure it loads first.
> I don't think you can guarantee that on other systems.
>
> If you do decide to include the default vhost in the httpd.conf, you would
> need to put it before the line that includes conf.d
>
I decided to include it in the httpd.conf before the include
directive, just to be sure.
Thanks for you input.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Name based virtualhosts with default
Posted by Yehuda Katz <ye...@ymkatz.net>.
On Tue, Oct 1, 2013 at 10:02 AM, Redalert Commander <
redalert.commander@gmail.com> wrote:
> Our configuration has the typical include of
> "/etc/httpd/conf.d/*.conf", it is here that the vhosts are defined in
> separate files. Should the default also be placed in here or does it
> have to be defined at the end of the httpd.conf (master) configuration
> file?
>
> It is currently my understanding that I should place it at the bottom
> of httpd.conf; so to be sure it is that last that is matched, but I
> would like to hear from someone with more knowledge and/or experience
> about apache than myself.
> I would prefer it to be placed in the conf.d folder if possible.
>
It might depend on which distribution you are using.
Some systems (Debian, for example) will always load the config files in
alphabetical order, so the efault vhost is usually named 000-default to
ensure it loads first.
I don't think you can guarantee that on other systems.
If you do decide to include the default vhost in the httpd.conf, you would
need to put it before the line that includes conf.d
- Y