Forum Moderators: phranque

Message Too Old, No Replies

Virtual Hosts

         

adamj_88

9:28 pm on Nov 8, 2010 (gmt 0)

10+ Year Member



Hi,

I'm trying to run one virtual host and the default host, the virtual host is accessible through a domain and the default through a local ip (192.168.1.11).

My system uses 1 fixed IP address, so they should be name based virtual hosts, can't understand why this doesn't work, but I always end up both displaying the same content, if its the default or virtual hosts directory.

Here's the relevant conf data, see if anyone can help?

Listen *:80
Listen *:443
NameVirtualHost *

DocumentRoot "/srv/www/htdocs"
<Directory "/srv/www/htdocs">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
DocumentRoot /srv/www/domain.com
ServerName www.domain.com
<Directory "/srv/www/domain.com">
allow from all
Options -Indexes
</Directory>
</VirtualHost>


Thanks,
Adam

sublime1

3:04 am on Nov 13, 2010 (gmt 0)

10+ Year Member



I am pretty sure once you declare NameVirtualHost, you need to specifically declare a default host.

This can be a little tricky -- I believe that (named) VirtualHosts are processed in alphabetical order, and in Ubuntu, for example, there's a special default virtual host named something like "000-default" which will be processed first and therefore be the default host.

Or maybe you can specify the internal IP in the "default" virtual host. More info here: [httpd.apache.org...]

Tom