help with Virtual Hosts on Apache

Wade Smart wade at wadesmart.com
Mon Mar 26 23:52:21 UTC 2007


03262007 183 GMT-6 DST

Im working on setting up joomla on my system. To get this installed
though I had to setup virtual hosts. This way I can test various sites
out.

On this tutorial
http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2
I followed the instructions to setting up a virtual host.
Ill repost a very condensed version here:

1) cd /etc/apache2/sites-available

2) sudo gedit name.com.conf

Paste:
<VirtualHost dev.example.com>
  ServerAdmin webmaster at localhost
  ServerAlias www.dev.example.com
  DocumentRoot /home/myuser/public_html/example.com
  ScriptAlias /awstats/ /usr/lib/cgi-bin/
  CustomLog /var/log/apache2/example.com-access.log combined
</VirtualHost>

3) cd /etc/apache2/sites-enabled/

4) sudo ln -s /etc/apache2/sites-available/name.com.conf name.com.conf

5) sudo gedit /etc/hosts
   add:
127.0.0.1 localhost.localdomain localhost dev.name.com www.dev.name.com

6) sudo /etc/init.d/apache2 reload

So I did this with these specifics:
<VirtualHost dale.com>
  ServerAdmin webmaster at localhost
  ServerAlias www.dale.com
  DocumentRoot /var/www/public_html/example.com
  ScriptAlias /awstats/ /usr/lib/cgi-bin/
  CustomLog /var/log/apache2/example.com-access.log combined
</VirtualHost>

and under /etc/hosts I added
127.0.0.1 sam.com dale.com

Problem is, what happens when I add a second and a third entry?

I created a second entry and received this error after restarting
apache:

[Mon Mar 26 18:34:24 2007] [warn] VirtualHost dale.com:0 overlaps with
VirtualHost sam.com:0, the first has precedence, perhaps you need a
NameVirtualHost directive

Am I doing this wrong?

wade





More information about the ubuntu-users mailing list