Can't make virtual host working

Posted by sica07 on Server Fault See other posts from Server Fault or by sica07
Published on 2011-11-28T22:53:02Z Indexed on 2011/11/29 1:53 UTC
Read the original article Hit count: 572

Filed under:
|
|
|

I have to create a virtual host on a server which, previously hosted a single website (domain name). Now I'm trying to add a second domain on this server (using the same nameserver). What I've done so far:

Initially there was no virtual host so I've made one for the second domain:

NameVirtualHost *:80
<VirtualHost *:80>
        DocumentRoot /var/www/bla
        ServerName www.blabla.com
        ServerAlias blabla.com
    <Directory /var/www/blabla>
        Order deny,allow
        Allow from all
        AllowOverride All
    </Directory>
</VirtualHost *:80>

Because nothing happend, I changed the DocumentRoot of the apache server to /var/www (initially was the root document of the first website -/var/www/html) and created a virtual host for the first domain too:

   <VirtualHost *:80>
            DocumentRoot /var/www/html
            ServerName www.first.com
            ServerAlias first.com
        <Directory /var/www/html>
            Order deny,allow
            Allow from all
            AllowOverride All
        </Directory>
    </VirtualHost *:80>

In this case, first.com is working ok, but bla.com not.
When I ping blabla.com I get the "unkown host" response. What am I doing wrong? Do I have to modify something in the DNS settings too? Thank you.

© Server Fault or respective owner

Related posts about apache2

Related posts about dns