OS: Ubunutu 12.x
Web server: apache 2.x

So here is what I was trying to accomplish. I have a server with many sites in their own directories. I had one that I wanted to just use a hostname to access it. Now, I have done this many times in CentOS/Redhat, but never in Ubuntu, and it adds a little twist to the process. First the name needed to be added to the DNS. I created a CNAME, since I already had a name in for the server.


vi /etc/apache2/apache2.conf

NameVirtualHost *:80
<IfModule mod_ssl.c>
 NameVirtualHost *:443

cd /etc/apache2/sites-available

Created a file with a descriptive name of my site:

vi some.hostname.com

Added the following as appropriate for my site:

<VirtualHost *:80>
 ServerName some.hostname.com
 ServerAlias some
 DocumentRoot /var/www/some

There are many other options you can add here, but this is where I started.

cd /etc/apache2/site-enabled
ln -s ../sites-avaiable/some.hostname.com
service apache2 restart