Setting up virtual hosts gives us the flexibility of setting up multiple hosts on a local machine, in other words we can use this method to host more than one domain name on the same machine, including of course on servers running locally. Usually when you setup Apache, you dump all your sites under htdocs and then you access them on your browser by using localhost/[directory-name]. Although this is good, sometimes its not convenient. For instance, when using CMS applications such Drupal or WordPress Mu, you might want to be able to setup multiple sites under the same local installation so that it mimics your live site installation.
To setup multiple hosts, we're gonna edit two files under both Windows and Mac. One of this files will be used to create the hosts, and the other will be used to map the hosts to our local IP address. Also, in order to modify these files you must use an account with administrator permissions.