Multisite or domain access installation?

Popular open source CMS
KBleivik
Site Admin
Posts: 178
Joined: Tue Sep 29, 2009 6:25 pm
Location: Moss Norway
Contact:

Multisite or domain access installation?

Postby KBleivik » Mon Jul 04, 2011 10:14 am

Like the WordPress 3.+ multi site / user viewtopic.php?f=18&t=220 it is possible to have a Drupal multisite installation.

f 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 core code, contributed modules, and themes) among several sites. Before we learn more about drupals multisite platform we draw your attention to the Domain Access module.

The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database. The module allows you to share users, content, and configurations across a group of sites such as:
  • example.com
  • one.example.com
  • two.example.com
  • my.example.com
  • thisexample.com <-- can use any domain string
  • example.com:3000 <-- treats non-standard ports as unique
By default, these sites share all tables in your Drupal installation.

So when should you use the domain access module and when should you use the multisite platform? If multiple sites should share the same code, but have separate data you should use Drupal's multi-site configuration. If on the other hand multiple sites (or domains) should share the same code and the same data, though they may have different layouts and styles you should use Drupal with the Domain Access module. There is one important concern if you are on a shared host (see blow) and all sites share the same database, you may get problems if you move the sites to its unique domain (e.g. on a different server). You have to ask these question:
  1. Can I use the common database for each unique domain? I have not tested it, but assume you can.
  2. If yes, is that database minimalistic for that unique site?
  3. How easy is it to tune / tweak the database?
  4. If you are a competent SQL programmer, there should of course be no (minor) problems.

Enough about the domain access module.

The multisite platform is particularly useful for managing the code since each upgrade only needs to be done once. Each site will have its own database and its own configuration settings, so each site will have its own content, settings, enabled modules, and enabled theme. However, the sites are sharing a code base and web document root, so there may be security concerns (see section below for more information).

Source: Run multiple sites from the same code base

See the Drupal coder blog for related information: Drupal 7 multisite improvement : multi-site directory aliasing

Then scroll down to the section: Multisite configuration

There you find most of the information you need.

In addition to the above article, the information needed to set up a multisite aliasing is written in the INSTALL.TXT file of the root folder. Note the following:

Note that all directories mentioned in this document are always relative to the directory of your Drupal installation, and commands are meant to be run from this directory (except for the initial commands that create that directory).


For additional information read the comment of the file: <Your Drupal 7-X installation>/sites/example.sites.php that starts as:

Code: Select all

/**
 * @file
 * Configuration file for Drupal's multi-site directory aliasing feature.
 *


From the book, Drupal 7 Multi Sites Configuration page 27 we note the following:

It is best to create one database per site. Only when absolutely necessary should you install multiple Drupal sites into the same database instance. For example, if you are only allocated a single database instance for multiple sites, you can use Drupal's database prefix feature, which is documented online at http://drupal.org/documentation.


Note the README.txt file in <Your Drupal 7-X installation>/sites/all with the following content.
This directory should be used to place downloaded and custom modules and themes which are common to all sites. Keeping contributed and custom modules and themes in the sites directory will aid in upgrading Drupal core files. Place contributed and custom modules and themes in the sites/all/modules and sites/all/themes directories respectively.

There are similar README.txt files int the <Your Drupal 7-X installation>/sites/all/modules and <Your Drupal 7-X installation>/sites/all/themes directory.

If your domains are add on domains on a main domain, you can get problems. First of all you should create this file:

checkhost.php

Code: Select all

<?php
print $_SERVER['HTTP_HOST'];
?>

and run it on your main domain and your addon domain. If these print the two different domains, then it is probably OK for a multisite installation on your sever. If not, I don't know how to set up a multisite installation on a main and an add on domain. If you have a subfolder with the same name as the add on domain, you have to delete it before you continue. Then I created this file:

newsymlink.php

Code: Select all

<?php
symlink(".", "addondomain.com");
//create as many symbolic links as you need here for all of your domains
print "Done";
?>

and uploaded it to the server in the public folder of the main domain. Then run the file on my main domain and got Done. Then I loaded the address of the addon domain in my browser and I was redirected to the standard drupal configuration page. I use a different database for the main and the addon domain. For additional information, look here: http://groups.drupal.org/node/54608

The resource requirements may be bigger for a multisite installation and may require loadbalancing http://en.wikipedia.org/wiki/Load_balan ... mputing%29 on multiple servers.

We end this post with a note on security.

If you host multiples sites on the same server in a multi-site environment, all your sites are at a risk if the shared code is hacked.Like the WordPress 3.+ multi site / user viewtopic.php?f=18

Return to “Drupal”

Who is online

Users browsing this forum: No registered users and 1 guest