A single Drupal installation can host several Drupal-powered sites, each with its own individual configuration.
Configuration
Additional sites configurations are represented by creating subdirectories under the ‘sites’ directory of the Drupal installation. For example, the configuration for www.vincentkong.com could be ‘sites/www.vincentkong.com’. If users can access the site at http://vincentkong.com as well then ‘www.’ should be omitted. Subdomains are also support, for example, my.vincentkong.com would be ‘sites/my.vincentkong.com’. Drupal will transverse through the directories and find the best matching directory for the site requested.
After the proper directory for your domain has been created copy the default configuration file ‘/sites/default/settings.php’ into the your new directory.
$ cp ./sites/default/settings.php ./sites/vincentkong.com
Run the install script by pointing your browser to the base url of your website (e.g http://www.vincentkong.com), and follow through with the setup screens. Ensure that you DO NOT overwrite any existing databases.
Site-Specific Modules and Themes
Each site can have it’s own specific modules and themes in additional to those installed in the standard ‘modules’ and ‘themes’ directories in the base installation. To use site-specific modules or themes, create the ‘modules’ or ‘themes’ directory within the site configuration directory.
$ mkdir ./site/vincentkong.com/modules
$ mkdir ./site/vincentkong.com/themes
Apache
When setting up virtual hosting for Apache to support multiple sites for Drupal, the DocumentRoot for all the sites should be set to the base directory of the Drupal installation. For example if my Drupal was installed in /var/www/html
<VirtualHost *>
ServerName www.vincentkong.com
DocumentRoot /var/www/drupal
</VirtualHost>
<VirtualHost *>
ServerName my.vincentkong.com
DocumentRoot /var/www/drupal
</VirtualHost>
Related posts: