Virtual Host Apache2 Ubuntu
Mon, 27 Sep 2010This 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.
Step 1
Open Terminal your terminal and goto the /etc/apache2/sites-enabled directory.
$ cd /etc/apache2/sites-enabled/
Step 2
Create a file for your site (I prefer to use nano)
$ sudo nano workspace.conf
Step 3
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>
Step 4
Now you have to edit your /etc/hosts file
$ sudo nano /etc/hosts
Step 5
Then at the top just add your ServerAlias
127.0.0.1 workspace
Step 6
Reload Apache and go to your site http://workspace
$ sudo /etc/init.d/apache2 reload