Steps to Set Up an Aliased Local Server on Ubuntu

Note: This assumes that apache has been installed.
For more details see HTTPD - Apache2 Web Server

Edit hosts file

sudo gedit /etc/hosts

Add an entry for the new website. For example:

127.0.0.1 cooltestsite.local

Copy default profile and edit accordingly:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/cooltestsite

Add the following lines to the file:

ServerName cooltestsite.local

ServerAlias *.cooltestsite.local

AccessFileName .htaccess

Note: Be sure to create the log sub directory in the directory for your new site.

Enable the virtual host using a2ensite.

sudo a2ensite cooltestsite

Reload apache if prompted and then restart.

sudo /etc/init.d/apache2 reload

sudo /etc/init.d/apache2 restart

Other helpful reference pages

ApacheMySQLPHP

LocalhostSubdomain