httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jez Hancock <jez.hanc...@munk.nu>
Subject Re: [users@httpd] Very very strange problem with virtualhost's
Date Sun, 15 Feb 2004 17:11:44 GMT
On Sun, Feb 15, 2004 at 06:08:06AM +0100, Antonio Guillermo Martinez (Silvereme) wrote:
> I've an include in the httpd.conf file to include vhosts.conf (and
> namevirtualhost * (and tested with namevirtualhost *:80) in the httpd.conf
> file). In the main httpd.conf file I've nothing more about virtualservers.
<snip>

Start off by tidying up the config.

In httpd.conf place this:

-snip-
NameVirtualHost *
Include /path/to/vhosts.conf
-snip-

and then in /path/to/vhosts.conf put:

-snip-
# This will be the default vhost used if a domain name resolves to any
# ip address hosted on your machie that has no corresponding
# <VirtualHost> stub:
<VirtualHost *>
	DocumentRoot E:\internet\dominios\silvereme.com
	ServerName silvereme.com
	ServerAlias www.silvereme.com
	CustomLog "E:\logs\apache\silvereme.com.log" combined
	<Directory "E:\internet\dominios\pi-erre.com">
	  Options All
	  AllowOverride All
	  Order allow,deny
	  Allow from all
	</Directory>
</VirtualHost>

<VirtualHost *>
	DocumentRoot E:\internet\dominios\pi-erre.com
	ServerName pi-erre.com
	ServerAlias www.pi-erre.com
	CustomLog "E:\logs\apache\pi-erre.com.log" combined
	<Directory "E:\internet\dominios\pi-erre.com">
	  Options All
	  AllowOverride All
	  Order allow,deny
	  Allow from all
	</Directory>
</VirtualHost>


<VirtualHost *>
	DocumentRoot E:\internet\dominios\geekiberico.com
	ServerName geekiberico.com
	ServerAlias www.geekiberico.com
	<Directory "E:\internet\dominios\geekiberico.com">
	  Options All
	  AllowOverride All
	  Order allow,deny
	  Allow from all
	</Directory>
</VirtualHost>
-snip-

The main differences here are the use of NameVirtualHost - it only needs
to be used once in the main httpd.conf - and the use of <VirtualHost *>
instead of <VirtualHost domain.com>.

If you did want to host different vhosts on different IP addresses then
you would do:

NameVirtualHost 1.2.3.4:80	# configure named virt hosting on 1.2.3.4:80
NameVirtualHost 1.2.3.5:80	# configure named virt hosting on 1.2.3.5:80

and then in your virtualhost containers you would start them as:

# this is default vhost for 1.2.3.4:80:
<VirtualHost 1.2.3.4:80>
	somedomain-on-1.2.3.4.com
	...
</VirtualHost>

... other vhosts on 1.2.3.4:80 here

# this is default vhost for 1.2.3.5:80:
<VirtualHost 1.2.3.5:80>
	somedomain-on-1.2.3.5.com
	...
</VirtualHost>

... other vhosts on 1.2.3.5:80 here


By using 'NameVirtualHost *' you're saying that you want to be able to
use named virtual hosting on ANY available IP address - and using
'<VirtualHost *>' indicates that you want this virtual host to listen on
ANY available IP.

Hope that clears things up a bit.

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - Another FreeBSD Diary
http://ipfwstats.sf.net/        - ipfw peruser traffic logging

---------------------------------------------------------------------
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