Equipment HP Pavilion 6745C/700 MHz Celeron/256MB ram. I’m using gvim as an editor.
Step 1, Add host to /etc/hosts:
sudo gvim /etc/hosts
Before the IPv6 section (if you have one), add:
127.0.0.1 latte
In this case “latte” is my virtual hostname.
Step 2, Add a new configuration file for the virtual host:
cd /etc/apache2/sites-available
cp default latte.conf
The naming of the configuration file is somewhat arbitrary, but I used {hostname description}.conf.
Step 3, Edit the configuration file:
sudo gvim latte.conf
Change the following lines and save your configuration file:
NameVirtualHost *
DocumentRoot /var/www
to the following:
NameVirtualHost latte
DocumentRoot /var/www/latte
Your original “DocumentRoot” may be different, but the new value should be the root directory for website files.
Step 4, Link to the configuration file in the “sites-enabled” directory:
cd /etc/apache2/sites-enabled/
sudo ln -s /etc/apache2/sites-available/latte.conf latte.conf
or in Debian (and by derivation, Ubuntu):
a2ensite latte.conf
Step 5, Reload the apache configuration file:
sudo /etc/init.d/apache2 reload
Step 6, Browse to your virtual server to check your work:
firefox http://latte