RSS

HOW-TO: create a multisite in Drupal using subdirs and without a domain name

26 Feb

Recently I had to create a multi-site Drupal system for a project (that means different organizations will be able to use the same Drupal system but with completely independent database, themes, modules, etc.) . Even though there are lots of documentation on this spread over the Internet it did not turn out to be very easy for my case.

Description of my case:

– An Ubuntu GNU/Linux server
– Drupal version 6 installed by aptitude install drupal6
No domain names. I reach the remote server by its IP address e.g. http://100.101.102.103/drupal6

So the default set up is OK, I can visit http://100.101.102.103/drupal6 and see the content but I wanted to create another independent Drupal site using the same source codebase., e.g. http://100.101.102.103/drupal6/iris

The most critical part turned out to be not the instructions in the Internet documentation but in the /usr/share/drupal6/sites/default/settings.php file:


 * For example, for a fictitious site installed at
 * http://www.drupal.org/mysite/test/, the 'settings.php'
 * is searched in the following directories:
 *
 *  1. sites/www.drupal.org.mysite.test
 *  2. sites/drupal.org.mysite.test
 *  3. sites/org.mysite.test
 *
 *  4. sites/www.drupal.org.mysite
 *  5. sites/drupal.org.mysite
 *  6. sites/org.mysite
 *
 *  7. sites/www.drupal.org
 *  8. sites/drupal.org
 *  9. sites/org
 *
 * 10. sites/default

According to this explanations if I want to have another Drupal site such as http://100.101.102.103/drupal6/iris then I should create a directory like that

100.101.102.103.drupal6.iris

in

/usr/share/drupal6/sites/

and this seems to be the most critical part that caused me trouble until I realized the solution. Except this I just copied the settings.php from the existing /usr/share/drupal6/sites/default/ directory to the directory I created above, did the dbconfig.php customization, created another database in MySQL server and did not forget to create a symbolic link by issuing the command

sudo ln -s . iris

at /usr/share/drupal6

Finally I pointed my browser to http://100.101.102.103/drupal6/iris/install.php and everything worked as expected.

Some more URLS:

Create Multi-site for dummies

Grant write permissions on the configuration file

Run multiple sites from the same code base (multi-site)

Advertisements
 
Leave a comment

Posted by on February 26, 2010 in sysadmin

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: