Virtual Hosts are used to run multiple domain of a single IP address. This is especially useful to people who need to run several sites off of one virtual private server. The sites display different information to the visitors, depending on with which the users accessed the site.There is no limit to the number of virtual hosts that can be added to a VPS.
To setting up virtual host, It’s require the user to have root privileges. My assumption you are already install LAMP.
1. The first step in creating a virtual host is to a create a directory where we will keep the new website information. do create new folder and file on your site root directory, ex site.com
3. still in etc folder, go a head to open apache2 folder and find sites-available, in this folder, create new documment empty and call it site.com, and then open it in your favorite text editor (as root). copy it and save
4. go back to the terminal, and write this command :
sudo a2ensite site.com and then enter, put your password root
5. Reload your web server with this command :
sudo /etc/init.d/apache2 reload or
sudo apache2 reload
6. open up your favorite browser and go a head to typing this : site.com and enter.. your virtual host is a live now.