Virtual Host Apache2 UbuntuMon, 27 Sep 2010
This is a quick run down of commands you need to install a Virtual Host on Ubuntu. I'll assume you already installed Apache2 and it's up and running. For my example I'm going to create http://workspace/ -- that's where I like to work on my personal projects.
Open Terminal your terminal and goto the /etc/apache2/sites-enabled directory.
$ cd /etc/apache2/sites-enabled/
Create a file for your site (I prefer to use nano)
$ sudo nano workspace.conf
For my site, I to have http://workspace to serve files from /home/jesse/workspace directory. So the data in the file goes:
<VirtualHost workspace> ServerAlias workspace DocumentRoot /home/jesse/workspace </VirtualHost>
Now you have to edit your /etc/hosts file
$ sudo nano /etc/hosts
Then at the top just add your ServerAlias
Reload Apache and go to your site http://workspace
$ sudo /etc/init.d/apache2 reload