If you use a LAMP stack, you can set this up fairly easily. Here's how:
- Move the application out of your document root.
- Create multiple document roots, one for each domain.
- Each document root should have symbolic links to any assets directories, or anything else that is accessible from the domain that needs to be the same. Maybe assets, and js. css and images may need to be local if each domain needs a different look and feel.
- Set up a different virtual host for each domain.
- your index.php needs to be different for each domain to give each domain it's own configuration file.
- Create a separate configuration file for each domain which will allow you to provide localized database configuration information.
- You can merge the localized configuration with a common configuration so that you don't have to duplicate the entire main.php.
Under Windows you can do the same thing, but everything that remains in your document root needs to be duplicated once you move the application out of document root.
Here is an interesting page to read: http://www.yiiframework.com/wiki/116/moving-project-code-outside-of-webroot-plus-multiple-project-support/