1,105,406 Community Members

creating server alias in Ubuntu 12.04

Member Avatar
dwlamb
Junior Poster in Training
58 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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>
Member Avatar
cereal
Posting Virtuoso
1,710 posts since Aug 2007
Reputation Points: 461 [?]
Q&As Helped to Solve: 345 [?]
Skill Endorsements: 44 [?]
 
0
 

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.

Member Avatar
dwlamb
Junior Poster in Training
58 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Question Answered as of 1 Year Ago by cereal
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article