Virtual Hosts definition outside of httpd.conf

This is a discussion on Virtual Hosts definition outside of httpd.conf within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi all, When I define a VirtualHost in a config file that is included into httpd.conf with Include, it ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-15-2005
Bart Friederichs
 
Posts: n/a
Default Virtual Hosts definition outside of httpd.conf

Hi all,

When I define a VirtualHost in a config file that is included into
httpd.conf with Include, it uses that as the default host. However, when
I put that exact same definition into httpd.conf, it works as expected.

To clarify:

httpd.conf:
Listen x.x.x.x:p
DocumentRoot /the/right/path
Include virthosts.conf

virthosts.conf:
<VirtualHost x.x.x.x>
DocumentRoot /foo/bar
ServerName name.tld
</VirtualHost>

The above definition will use /foo/bar as DocumentRoot, when accessing
the server with its IP address.

This setup:

httpd.conf:
Listen x.x.x.x:p
DocumentRoot /the/right/path

<VirtualHost x.x.x.x>
DocumentRoot /foo/bar
ServerName name.tld
</VirtualHost>

Will use /the/right/path as DocumentRoot when accessing the server with
its IP address.

Can anyone shed some light on this? In my opinion they should *both* use
/the/right/path as DocumentRoot.

TIA
Bart Friederichs
  #2 (permalink)  
Old 11-15-2005
Bart Friederichs
 
Posts: n/a
Default Re: Virtual Hosts definition outside of httpd.conf

Davide Bianchi wrote:
> On 2005-11-15, Bart Friederichs <bf@tbwb.nl> wrote:
>
>>httpd.conf:
>> Listen x.x.x.x:p
>> DocumentRoot /the/right/path
>>
>> <VirtualHost x.x.x.x>

>
>
> I think that in this case, in your httpd.conf there is a "NameVirtualHost"
> directive missing, hence your vhost is not used at all.


The NameVirtualHost is there. All other virtual hosts work correctly.

The two config files are entirely identical, except for the fact that in
one case everything is in httpd.conf and in the other a part is in
another config file, that is included in httpd.conf.

Bart
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:41 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0