Ivan Zugec

Drupal Consultant

Setting up Drupal multi-site on DreamHost

A couple of nights ago i spent 2 hours trying to figure out how to setup a multi-site on DreamHost. What i needed was to run 3 different domains(domain1.com, domain2.com, domain3.com) off one code base but running off separate databases.

multisite_flow.pngPrepare
Make sure all the domains have been added via panel.dreamhost.com and are working. So now if you SSH into DH you should see the following folders in your account folder "/home/username" (username is your DH useraccount):

/home/username/domain1.com
/home/username/domain2.com
/home/username/domain3.com

Install
Perform a standard drupal install on domain1.com (This domain will use /sites/default).
Create 2 folders in /sites. Which will be domain2.com and domain3.com. If you go into /sites you should see the following folders:

/sites/all
/sites/default
/sites/domain2.com
/sites/domain3.com

Paste in a copy of settings.php into the domain2.com and domain3.com folders.

SSH
Go back to /home/username and remove the domain2.com and domain3.com folders which were created by DH.

SSH into the server and perform the following commands:(DO AT YOUR OWN RISK)

# rm -r domain2.com
# rm -r domain3.com

Now we'll have to create symbolic links.
Add the following commands:

# ln -s /home/username/domain1.com/ /home/username/domain2.com
# ln -s /home/username/domain1.com/ /home/username/domain3.com

Now go to domain2.com or domain3.com you'll get the install page. Fill out the install page and everything should be working.

About the author: Ivan Zugec
Ivan Zugec's picture

Ivan is a Sydney Australia based Drupal Developer with over 5 years experience.

Follow:
Category: 

Comments

rhache@drupal.org's picture

Submitted by rhache@drupal.org on

Do you have any idea how it's different if you want them to share a db?

Thanks for the article.

t.a. barnhart@drupal.org's picture

Submitted by t.a. barnhart@d... on

my domain1 works fine.
i created sites/domain2
copied in a clean settings.php to that folder
made my symlink

(btw, DH shows the server - in my case .poly - when you use ftp to look at things; that's a bit confusing, but it appears to be optional to include it)

then when i go to my site, i get the internal server error

in the webhost panel for domain2, i have the web directory for site2 set to site2 -- in looking at other ways of doing this multisite gig, one suggested having the web directory point to site1. i thought symlinks precluded the needed to do that or redirecting. whatever the case, i am not getting the install; just the 500 error.

tia,
t.a.


later:

i tried a couple of things that worked, but i'd like your feedback (because the rest of your directions were so simple & clear).

for domain2, i mirrored it to domain1.
for domain3, i set the web directory to domain1.

both options worked. what i have not tried is if that works without the symlinks.

t.a. barnhart@drupal.org's picture

Submitted by t.a. barnhart@d... on

i have taken a domain (projectc.net) that is just the domain we bought to point to the "real" site, projectc.com (we also bought .org). i set its web directory (using the DH web panel) to my main drupal install (btc.com). i made the necessary folder in sites: btc/sites/projectc.net/ and added a clean settings.php

no symlink

wait 10 minutes

go to projectc.net -- voila, drupal install dialog

my conclusion: symlinks are not needed here. i'm going to run this past DH, but perhaps the setting of the web directory acts, or is, a symlink?

is this something you've done? if it really is this simple, then i will be a happy wee camper.

crios's picture

Submitted by crios on

I would like to setup a multisite installation with 2 separate databases (is there any advantage to using 1 database?) but instead of domain1 or domain2 I'd like to use:
sub.domain.com/foo1
sub.domain.com/foo2

I've tried following the directions here but they don't seem to work on Dreamhost. I get a standard install that ignores the sites folder.

laura's picture

Submitted by laura on

Hi,
thanks for the post, definitely useful for me, as a very newbie in all this.
My question: where do you upload all the drupal files?
I did it under home/username/domain1.com/drupal but then my website name ends up like www.domain1.com/drupal which i want to avoid. ( tried to specify it in settings.php, but not much success :( )
Any tip? ( I am also in dreamhost)

thanks

admin's picture

Submitted by admin on

@ laura

Place the files in "home/username/domain1.com" not "home/username/domain1.com/drupal"

On dreamhost when you add a new domain name the system creates a domain.com folder, thats the document root for that domain.

Hope this helps.

cheers,
Ivan

Add new comment