Setting up virtual domains (hosts) in your linux server is dead simple. If you have apache2 running all you have to do is put the following lines in the httpd.conf file. It is located in /etc/apache/conf/httpd.conf

First decide you want to setup the domain in shared IP or you want a dedicated IP for the domain.

Domain with Shared IP


ServerAlias www
ServerName www.example.com
DocumentRoot /var/www/example.com