I am trying to set-up some virtual hosts on a fresh install of Ubuntu 12.04 and not getting expected results. I am using this tutorial which I have used before without fail.

The challenge seems to come with restarting apache.

$> sudo service apache2 restart 
  * Restarting web server apache2   apache2: Could not reliably determine the server's fully qualified
  domain name, using 127.0.1.1 for ServerName
  .. waiting apache2: Could not reliably determine the server's fully qualified domain name, using 
  127.0.1.1 for ServerName

If I go through all of the steps, the alias I am trying to establish renders the root of localhost in my browser not the path set in sites available file.

Attempting to troubleshoot this, I removed the site with a2dissite and removed the site in /etc/hosts. Restarting apache as above, I receive the same error result. So it would appear something is not working properly in the first place, never mind attempting to add more hosts.

/etc/hosts content without additional hosts, rendering error messages found above:

127.0.0.1   localhost
127.0.1.1   daniel-dell-ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Excerpt for the sites-available directory for lh-test_site

    DocumentRoot /var/www/test_site
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/test_site/ >
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

Recommended Answers

All 2 Replies

You have to add the ServerName directive into the lh-test_site file:

ServerName testsite
DocumentRoot /var/www/test_site
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/test_site/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

then inside /etc/hosts add:

127.0.0.1 testsite

and run a2ensite as before, it should work.

Thanks for the input. Your advice helped and pointed out a flaw in the how-to I used to set-up all of the server aliases on my previous install of Ubuntu. Not one of those had a ServerName directive and they worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.