NOTE: This procedure works in Apache 2 and later, is slightly different in earlier versions

  1. Add the name of the domain in /etc/hosts or DNS
  2. Enable the virtual host module in Apache
    a2enmod vhost_alias (if it's already enabled, a2enmod tells you so)
  3. Create the virtual host configuration file.
    * cp /etc/apache2/sites-available/default /etc/apache2/sites-available/<new-domain>
    * Edit <new-domain> accordingly (at least the directives ServerName and DocumentRoot should be modified)
  4. Enable the new virtual host
    a2ensite <name-of-new-domain>
  5. Restart apache
    /etc/init.d/apache2 restart