Re: help with Virtual Hosts on Apache



On Tuesday 27 March 2007 01:52:21 Wade Smart wrote:
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@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@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?


I can remember that long ago i was fiddeling around with
Virtual Hosts too.

My solution was the following:

Add the following lines in /etc/apache2/sites-available/default

<VirtualHost *>

ServerName sveri
DocumentRoot /var/www/privat/

</VirtualHost>

<VirtualHost *>

ServerName alcoholics
DocumentRoot /var/www/alcoholics/

</VirtualHost>

and add in /etc/hosts
127.0.0.1 sveri
127.0.0.1 alcoholics

This still works for me.


Greetings
Sven Richter

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: CSWS and Server-Side Includes
    ... >> ServerAdmin maustin@firstdbasource.com ... >> AllowOverride None ... > You have a separate config file for your virtual hosts? ... root is at OS Document root. ...
    (comp.os.vms)
  • Re: installing joomla /and now/ setting up directory
    ... Make special areas (whether they be virtual hosts, or writable areas, etc.) outside of the tree. ... ServerAdmin webmaster@xxxxxxxxxx ... Options Indexes FollowSymLinks ...
    (Fedora)
  • RE: problems with setup apache and virtual hosts file
    ... Missing line - NameVirtualHost 202.189.72.35 ... problems with setup apache and virtual hosts file ... ServerAdmin webmaster@localhost ...
    (Ubuntu)
  • help with Virtual Hosts on Apache
    ... though I had to setup virtual hosts. ... sudo gedit name.com.conf ... ServerAdmin webmaster@localhost ... what happens when I add a second and a third entry? ...
    (Ubuntu)