Virtual hosts are used to run more than one web site on a single machine.
Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “name-based”, meaning that you have multiple names running on each IP address.

I want to show you one of mine scripts for easy create virtual hosts in Debian Squeeze or ubuntu.

#!/bin/bash
VHOST_CONF=/etc/apache2/sites-enabled/
ROOT_UID=0
NOTROOT=87
WWW_ROOT=/var/www/

# Check if is root
if [ "$UID" -ne "$ROOT_UID" ]
then
echo “You must be root to run this script.”
exit $NOTROOT
fi

if [ -n "$1" ]
then
DOMAIN=$1
else
echo “You must provide a full domain name for this site, i.e. ‘example.com’ ”
echo -n “Run this script like ./script example.com .”
exit
fi

#Create document root site folder
mkdir -p $WWW_ROOT/$DOMAIN

CONF=”\n\n##################\n# $DOMAIN\n##################\n\n ServerAdmin webmaster@$DOMAIN\n ServerName $DOMAIN\n ServerAlias www.$DOMAIN\n DocumentRoot \”$WWW_ROOT/$DOMAIN\”\n \”\n Options Indexes FollowSymLinks\n AllowOverride All\n Order allow,deny\n Allow from all\n \n ErrorLog /var/log/apache2/$DOMAIN-error_log\n CustomLog /var/log/apache2/$DOMAIN-access_log common\n \n”

echo -e $CONF > $VHOST_CONF/$DOMAIN

echo “$DOMAIN was created. In 5 seconds your apache will be restarted”
sleep 5

apachectl restart

echo “Done”
exit 0

You can download this script directly from HERE
Enjoy.