How to documentation for creating Drupal 7 multisite configuration

jbergloff's picture

Let's create a wiki or documentation for "How to documentation for creating Drupal 7 multisite configuration".

I can help test and write the documentation. I may need some help setting mine up, too. So this would be beneficial for everyone.

Comments

Ciril Tharayil's picture

I am also really looking forward to multisite installation.
I think this is a must have documentation, because they changed a lot of things and the way the multisite works in Drupal7.
It really confuses, especially with the new example.sites.php

Can someone please give at least an explanation about the multisite configuration with multilanguage in Drupal7.

Very Interested and Trying to Figure it Out

weekbeforenext's picture

I can't seem to find any Drupal 7 specific direction for getting multisite up and running. I'm trying different methods of installing Drupal 7 on my local MAMP machine to see what works. Looking to get things going soon. More direction would be very helpful.

The first rule: Read the

Mile23's picture

The first rule: Read the code. :-) example.sites.php and default.settings.php tell you a lot, if you just read them.

The coolest addition in D7 is sites.php, which lets you set domain aliases, so that if you come from localhost (under MAMP, for instance), the connection can still be mapped to sites/yourfancysitename.com while you're developing and staging it. You can read it in the API documentation, which is taken directly out of the source file: http://api.drupal.org/api/drupal/sites--example.sites.php/7

The other cool thing is that D7 can let you mix and match databases and prefix much more flexibly than D6. This gets explained in default.settings.php. You can have master and slave DBs, and give different databases different names within Drupal. This is explained here: http://drupal.org/node/310071

An article on some of this: http://www.drupalcoder.com/story/544-drupal-7-multisite-improvement-mult...

My multisite docs as posted...

ratioswitch's picture

I've posted a lot of my research on my host's wiki related to setting up Drupal multisites on typical Shared & Reseller hosting accounts (LAMP stacks): http://wiki.a2hosting.com/index.php/Drupal (FYI: this page does in fact, link back to g.D.o/multisites).

I've also posted a step-by-step install on A2's Get Satisfaction site: http://community.a2hosting.com/a2hosting/topics/drupal_multisite

I would greatly appreciate any feedback (good or bad) so that I can correct them. I would have no problem moving some of that content to a D.o or an g.D.o/multisites page since this might help consolidate some of this documentation.

I'm now trying to get D7's sites.php to handle my multisite-ing needs but need to read more about both on *D.o. and within both the sites.php and settings.php core files.

Has a wiki page for Multisite documentation been created yet?

Thoughts?

_rs

It's actually easier to

Mile23's picture

It's actually easier to create a wiki page than it is to ask if someone else has created a wiki page. :-)

In fact: Wiki Page: Multisites Using Drupal 7. Edit away.

Local multisite installation

Fiable.biz's picture

Hello.

The page http://groups.drupal.org/node/121989 assumes one has a DNS. I don't. Moreover, it's not much detailled. After much struggle, I eventually succeeded in installing a second site, but I'm not sure I didn't do mistakes and I think I probably did useless things.

I installed Drupal 7 on Ubuntu 10.10., /var/www/drupal-7.0/ . It worked. The non-Drupal site I have in /var/www/site/ also worked.

Then I copied /var/www/drupal-7.0/sites/default/ to /var/www/drupal-7.0/sites/example.com/ ,
gave read and write permissions to everybody for that directory (and I should have given them to its files/ subdirectory too),
copied /var/www/drupal-7.0/sites/example.com/default.settings.php to /var/www/drupal-7.0/sites/example.com/settings.php ,
modified it like this:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'example',
      'username' => 'drupal_user',
      'password' => 'my_password.',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

I copied /var/www/drupal-7.0/sites/example.sites.php to /var/www/drupal-7.0/sites/sites.php ,
modified its last line like this:
$sites['example'] = 'example.com';

created an empty database schema called "example" with MySqlAdministrator,
gave to user drupal_user@localhost the same password as above and the SELECT, INSERT, DELETE, CREATE, DROP, INDEX, ALTER, CREATE_TMP_TABLE and LOCK_TABLES privileges to this new schema.

Ubuntu's /etc/apache2/apache2.conf contains the lines

Include ports.conf
Include conf.d/
Include sites-enabled/

ports.confs says "NameVirtualHost *:80".

I created a file called /etc/apache2/sites-enabled/drupal-7.0 saying:

<VirtualHost *:80>
   DocumentRoot /var/www/drupal-7.0
   ServerName drupal-7.0
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /var/www/drupal-7.0
   ServerName example
</VirtualHost>

a file called /etc/apache2/conf.d/drupal-7.0.conf saying

Alias drupal-7.0 127.0.0.1
Alias example 127.0.0.1

<Directory /var/www/drupal-7.0>
    Options +FollowSymLinks
    AllowOverride All
  order allow,deny
   allow from all
</Directory>

in the file /etc/hosts , I added "example " to this line of aliases:

127.0.0.1 example localhost.localdomain   localhost

relaunched Apache,
and went with my browser on the page http://example/install.php . It now works.

I realise that naming my folder "drupal-7.0" was a bad idea because browsers consider "drupal-7" as a subdomain of the top level domain "0" they go in internet to look for. Therefore http://drupal-7.0 doesn't work, I get my default website at the address http://localhost/drupal-7.0 .

Would anyone be so kind to check and clean this procedure?

What about a problem determination guide?

herb_miller's picture

It's all well and good documenting the steps to create a perfect installation but it doesn't help someone who has tried to follow the steps and has then come across a problem that's not explained.

In my case I get error 310 ERR_TOO_MANY_REDIRECTS whenever I attempt to navigate to one of my additional sites. See http://drupal.org/node/1093464

If anyone has experience of fixing this issue please can you document the solution.

Note: My installation was performed using a one-click install of Drupal 7 using Softaculous. I couldn't find example.sites.php in the installed files. I have a niggling feeling that something has gone awry in the setup. I will check with my hosting supplier and also try to perform a manual installation.

herb_miller's picture

When I realised what the problem was the phrase "oh my giddy aunt" (or something similar but unpublishable) came to mind.
In order to track down the problem I manually installed Drupal 7 and then performed the same steps to set up a multi-site solution.
It worked perfectly. No need for symlinks.

I then took a complete backup of the working and non-working implementations and compared the file systems file by file.
The problem was blindingly obvious. In the non-working version ( with the error 310 - infinite redirect) there was no install.php file.

So step one of the problem determination guide for installation obviously starts at checking if install.php is present.

I now have two Drupal 7 multi-site installations. 2 domains on each. Hurrah!

WIBNI Drupal multi-site install did the check itself?

Annotation to /etc/apache2/sites-enabled

stfwi's picture

Thanks for this quick installation guide, it was very helpful for me.

One little annotation according to the apache2 handling of sites: The config for every site is normally specified in the files
"/etc/apache2/sites-available". Then you use the commands "a2ensite" and "a2dissite" to include/not include these config files. The commands simply add/remove symbolic links to the config files in the sites-available directory. After using a2ensite/a2dissite, the command "service apache2 reload" can be used to refresh the configuration without restarting the apache service. { The system I refer this to: Apache/2.2.17 (Ubuntu) }.

I think the solution in the installation guide above will not cause any trouble though - however, if people use a2dissite it could happen that the config file is accidentally deleted or an error could occur.

This apache2 handling also means that the aliases and virtual host configuration can be split into two config files, which can be individually enabled/disabled.

Hope it helps, cheers.

Multisite documentation

hvasconcelos's picture

Here's a simple and quick guide to setting up a Drupal Multisite. Hope it helps someone!

http://www.coalmarch.com/blog/setting-drupal-multi-site

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: