How to Create virtual hosts in Apache

So today we are gonna take a look at Apache virtual hosts. One of the great things about virtual hosts is that you can host multiple instances with sub-domains for an example could i host joomla at if i had a sub-domain with that domain. it is a pretty simple thing to do, so lets get to it.

Step 1. Make directory for VH

So the first thing we are gonna do is to make our folder for our virtual host

We have to set permissions for Apache for the folder

The new thing is to set the right permissions so apache can manage the files and folders

Step 2. Create virtual host directories

We already have one host up and running. the defined root directory for that host is /var/www/html but we need to set the root directory for our new virtual host to /var/www/

So now we have made an copy of our conf. file and renamed it to so we should edit the file to use our new subdomain and RootDocument

You should make the file look like this

We are almost done by now, one more the last thing to do is to enable our new site

if you are using different domains you should edit you host file by entering this command

So we have now a virtual host we can access by the next thing we could do is to install for an example owncloud. You can find a tutorial on the site if you want to know how to  installing Owncloud on you web server