
Few people have requested me to write an article on setting up a Drupal multisite installation on Windows. Note that this discussion is adapted from a previous article I wrote which explained how to do this on shared hosting environments on cPanel.
Some things to consider before I get started. I assume you have installed your entire WAMP stack (Windows, Apache, MySQL, and PHP) on a local development system and are ready to proceed installing Drupal. If you like more information on how to do this, read How To Setup A WAMP Development Environment. Although I do not have access to Windows 2003/Windows 2008 server, the instructions here should apply.
In summary:
Before installing Drupal on your local system, please make sure you have the following settings:
Server Host: localhost
Port: 3306
Username: root
Password: your password hereWe have created a new MySQL database and a drupal database administrator account. The administrator was granted all access privileges.
Database name: drupal_mysite1
Username: drupal_admin
Password: passwordYou are now ready to install Drupal. Fire up your browser and type in the URL to your site.
The same steps above are repeated for adding additional domains to your server.
127.0.0.1 localhost
127.0.0.1 www.mysite1.com www.mysite2.com
127.0.0.1 imysite1.com imysite2.com<VirtualHost *:80>
ServerName www.mysite1.com
ServerAlias mysite1.com
DocumentRoot "c:/apache/htdocs/"
ErrorLog "logs/mysite1.com-error.log"
CustomLog "logs/mysite1.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName www.mysite2.com
ServerAlias mysite2.com
DocumentRoot "c:/apache/htdocs/"
ErrorLog "logs/mysite2.com-error.log"
CustomLog "logs/mysite2.com-access.log" common
</VirtualHost>Notice the setting of the DocumentRoots. They both share c:/apache/htdocs/. In a standard virtual host setup, it would look something like this:
<VirtualHost *:80>
ServerName www.mysite1.com
ServerAlias mysite1.com
DocumentRoot "c:/apache/htdocs/mysite1.com/"
ErrorLog "logs/mysite1.com-error.log"
CustomLog "logs/mysite1.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName www.mysite2.com
ServerAlias mysite1.com
DocumentRoot "c:/apache/htdocs/mysite2.com/"
ErrorLog "logs/mysite2.com-error.log"
CustomLog "logs/mysite2.com-access.log" common
</VirtualHost>The magic is provided by Drupal which uses index.php as a boot strap loader along with its own .htaccess to service all Drupal installed websites. It is also the reason why the DirectoryIndex index.php setting in httpd.conf is so important.
mysql> show databases;
mysql> create database drupal_mysite2;
mysql> use mysql;
mysql> grant all privileges on drupal_mysite2 to 'drupal_admin'@'localhost' identified by 'password';Thats pretty much it in a nutshell. Of course there is a lot of other neat stuff you can do so I'll leave it open here for another day.
Happy Drupaling!