Drupal 6.x · No known problemsLast modified: January 13, 2009 - 16:46
If you are running more than one Drupal site, you can simplify management and upgrading of your sites by using the multi-site feature. Multi site allows you to share a single Drupal installation (including contributed modules and themes) among several sites. This is particularly useful for managing the code since each upgrade only needs to be done once.
Each site would continue to have it's own database and its own configuration settings so each site would have entirely different content and you can still specify the theme, modules and other settings for each site.
To configure a new site
Create a new database for the site
Create a new subdirectory of the 'sites' directory.
Copy the settings.php file from the 'default' directory to the new directory.
Open the settings.php file in a text editor and specify the settings for the new site.
In your browser, navigate to the URL of the new site and continue with the standard Drupal installation procedure.
Domains and URLs
The new directory name is constructed from the site's URL. The configuration for www.example.com could be in 'sites/example.com/settings.php'. Note that 'www.' is not required to access your site at http://example.com/ - *.example.com is served from that directory unless a subdomain is also defined. You should also adjust .htaccess to redirect www to example.com.
You can also use sub domains and subdirectories for Drupal sites. For example, example.com, sub.example.com, and sub.example.com/site3 can all be defined as independent Drupal sites using the following directory setup:
sites/default/settings.php
sites/example.com/settings.php
sites/example.com.site3/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.site3/settings.php
If you are installing on a non-standard port, the port number is treated as the deepest sub domain. For example:
http://www.example.com:8080/ could be loaded from sites/8080.example.com/. The port number will be removed according to the pattern above if no port-specific configuration is found, just like a real sub domain.
Each site configuration can have its own site-specific modules and themes in addition to those installed in the standard 'modules' and 'themes' directories. To use site-specific modules or themes, simply create a 'modules' or 'themes' directory within the site configuration directory. For example, if sub.example.com has a custom theme and a custom module that should not be accessible to other sites, the setup would look like this:
sites/sub.example.com/settings.php
sites/sub.example.com/themes/custom_theme
sites/sub.example.com/modules/custom_module
Document root
One area of frequent confusion is that in a Drupal multisite installation the webserver document root is the same for all sites. For example with the following three sites: example.com, sub.example.com and example.com/site3 there will be a single Drupal folder and all sites will be calling the same index.php file.
Some webhosts automatically create a folder (i.e. example.com) when creating a new domain. In this case it is necessary to create a symbolic link to the Drupal folder.
Installing a separate site in subfolders is accomplished by adding it with a dot after the domain name - the site3 example above. This also needs a symlink created from the document root to itself -- e.g. 'ln -s /var/www /var/www/site3'.
Localhost
On many systems it is possible to create entries in a "hosts" file to create aliases for the localhost name for a local workstation. By creating aliases for localhost it is possible to create names such as localdev1.example.com and localdev2.example.com, both for the local computer.
No comments:
Post a Comment