I have setup an Apache 2 virtual host by this method.
under /etc/apache2/sites-available I've create a dummy_site_1.conf
dummy_site_1.conf
<VirtualHost local.dummy_site_1:80>
ServerName local.dummy_site_1
ServerAdmin webmaster@localhost
DocumentRoot /var/www/dummy_site_1
ErrorLog /var/log/apache2/dummy_site_1__error.log
TransferLog /var/log/apache2/dummy_site_1__access.log
<Directory /var/www/dummy_site_1>
AllowOverride Options Limit None
Options -Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>
DirectoryIndex index.php
#DISABLE HTTP TRACE
#RewriteEngine On
#RewriteCond %{REQUEST_METHOD} ^TRACE
#RewriteRule .* - [F]
</VirtualHost>
I also added this line the the httpd.conf:
ServerName local.dummy_site_1
Now all is working with this setup, I type local.dummy_site_1 in the URL and I can see my site.
The problem is when I try to add another site config dummy_site_2.conf and create about the same settings
dummy_site_2.conf
<VirtualHost local.dummy_site_2:80>
ServerName local.dummy_site_2
ServerAdmin webmaster@localhost
DocumentRoot /var/www/dummy_site_2
ErrorLog /var/log/apache2/dummy_site_2__error.log
TransferLog /var/log/apache2/dummy_site_2__access.log
<Directory /var/www/dummy_site_2>
AllowOverride Options Limit None
Options -Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>
DirectoryIndex index.php
#DISABLE HTTP TRACE
#RewriteEngine On
#RewriteCond %{REQUEST_METHOD} ^TRACE
#RewriteRule .* - [F]
</VirtualHost>
I also added this line the the httpd.conf:
ServerName local.dummy_site_2
I get this error:
user@host:/etc/apache2$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 [Wed Sep 15 14:00:43 2010] [error] (EAI 5)No address associated with hostname: Could not resolve host name local.dummy_site_2 -- ignoring!
... waiting [Wed Sep 15 14:00:44 2010] [error] (EAI 5)No address associated with hostname: Could not resolve host name local.dummy_site_2 -- ignoring!
Why? am I configuring this wrong?