Community & Support

Multisite Installation - Looking for Solution

I am a total newbie to Drupal. I just passed the level where I managed to upload drupal files into /public_html directory, create database, assign privilege, run install.php, create admin account and yes my first drupal 5.1-based site!

I then thought this setup was a bit messy as drupal folders and files are all over the place within public_html. Maintainance and updates will be troublesome. So I wanted to keep all drupal files within a "Drupal" folder.

Before we go into that, my hosting setup is like this - I am having one main domain with several addon domains. For example:

www.mainsite.com (main domain)

Addon domains:

www.addon1.com
www.addon2.com
www.addon3.com
...

In /public_html, the directories look as follows:

..
addon1
addon2
addon3
+++

My idea is to have drupal installed in a directory under public_html with a multisite ability.

..
addon1
addon2
addon3
drupal
+++

Each domain will have own database.

I tried this setup but it failed when I run install.php in browser as "www.mainsite.com/drupal/install.php".

I have gone through countless threads and came across first time in my life things such as symlink, "LN -S" command etc but still can't figure out how to achieve the desired configuration. I even got myself SSH access from my hosting provider in the process.

So here I finally end up to ask your advice on what and how to do actual setup for the mainsite as well as the addons. Thank you.

Comments

I know how you feel

I sympathise with how you must feel. I've been tearing my hair out over the last two weeks with a multisite installation and finally got it working yesterday.

I'm still trying to figure out which of the things I tried actually made it work and I know I read a lot of advise which ended up not being relevant. For example I did not need to use symlinks.

The key to getting it working was setting up my apache vhosts correctly for each site.

I don't have ssh access to my server at the moment so can't give you the ins and outs but it does appear to be relatively simple to set up, although difficult to explain.

With multisites you *must*

With multisites you *must* get it out of your head that it has anything to do with folders - ALL your information is stored in the db, Drupal just looks at the url passed to it to return that particular sites information/ pages - THIS ALL HAPPENS FROM THE SAME DRUPAL CODEBASE!!! You only have to install Drupal the one time, forget completely (for now) about symbolic links, you'd use them if you wanted to do fancier stuff or perhaps if you had certain restrictions.

So... For a very simple multisite just copy your sites/default/settings.php to;

sites/addon1.com/settings.php
sites/addon2.com/settings.php
etc.....

As I said this is for a simple multisite set up and so all your sites will share the modules/ themes/ directories no need to create anything else in sites/addon*whatever*.com/... You can if you like, but like I said - keeping it simple!

Obviously edit all your settings.php to point to their correct dbs.

Then, simply point all your apache vhosts to the same directory your Drupal folders reside in, eg;

<Directory "/var/www/localhost/*">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
        Order deny,allow
        Deny from all
</LimitExcept>
</Directory>

<VirtualHost *:80>
ServerName www.addon1.co.uk
ServerAlias
addon1.yourworkgroup addon1
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

<VirtualHost *:80>
ServerName www.addon2.co.uk
ServerAlias
addon2.yourworkgroup addon2
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

Ensure that your apache is actually set up to have vhosts by the way...

http.conf; (apache2)

Include /etc/apache2/vhosts.d/*.conf

Then... Well... That's it? I'd recommend having separate files folders for each of your sites else things really do get messy, but other than that you're good to go...

Pobster

I've spend a many hours on

I've spend a many hours on a book and wiki:

1.) Multisite: Directories, Databases, Documents & Settings: Requirements & Best Practices: http://groups.drupal.org/node/3735

and....

2.) Multisite Requirements Document: http://groups.drupal.org/node/3713

I've just purchased the new "Pro Drupal" from apress.com in eBook form. It's pretty good though there is little said regarding how to configure for "multisite" (I suppose they have to stop somewhere)

I've looked at most threads/book pages/issues, etc. on multisite and there is a need for some "howtos", best practices, etc. I started the book page and the wiki to hopefully encourage participation on a repository of knowledge, wisdom on multisite related subjects.

If someone has a better idea, let's talk.

===
Doug Ouverson
hear | see | say | do | teach

---
Doug | webmaster

I don't get what the big

I don't get what the big deal is about multisites, I can't understand why there's any need for books or groups on the subject? All you have to do is point all your vhosts to the same place and create your folders in your sites/ directory correctly. And that's most peoples problem, they don't name their directories correctly or they don't give them the correct permissions (or the settings.php files inside them) and so Drupal can't read them. I guess permissions aren't something the casual Windows user has really come across before? Maybe that's the problem?

I also think a lot of people can't comprehend that Drupal is a page 'server' and so they think they have to symlink or create site specific directories and whatnot. Think about it, there isn't a folder called node/ which contains your pages as files 1, 2, 3, 4, etc... Drupal serves up pages based on the url passed to it and that's exactly how it works with multisites. It takes the url, compares it against the names of the folders in your sites/ directory - if there's a match it then accesses the db referred to in the settings.php file and gives the appropriate output.

There's no need for a 'multisite requirements' list as there aren't any requirements? The only requirements are for you to decide whether you want to have separate databases or simply have one and use prefixes to signify your separate sites.

Pobster

Agreed

If you look carefully, most people that have trouble with multisite installations are using a control panel, esp. to add domains and subdomains. Pretty much all of these control panels were designed to work with static files and separate webroots. The worst are those that don't do "real" subdomains, but instead do Apache mod_rewrite stuff. Bad!

Morale of the story: get yourself a plain jane hosting account with one webroot and learn one or two commands on the command line to easily create new sites/domain.com folders and you're golden. The instructions in the Handbook walk through this in pretty specific detail. See http://drupal.org/node/53705 for one of the better pages.

--
The future is Bryght.

Think about all the things

Think about all the things the average web developer, systems admin, server adin, etc. has had to go through. I've been studying programming, the internet, networks, servers, and related technology for about 3-4 years now. Learning is an iterative process. I would hope that the leaders in the Drupal community would have some empathy for the others of us who aren't as far up the spiral.

I've spent a significant portion of my week trying to get my arms around how to get my server set-up to accommodate my multisite needs. I've read all I could, and still I'm unsure on many issues.

The challenge for me, is not knowing what questions to ask. I feel confident that I can articulate what I'm trying to do. I just don't understand how to get all my ducks in a row; what are the steps. What are the steps?

Do a search "multisite" and see what you come up with. Not much.

Thanks for taking the time; it is much appreciated.

Have a restful weekend, and all the best,

-Doug

---
Doug | webmaster

I'm half-way through

Thanks for all the help. Love your method which is clean and straight forward. I am seing things better now at least but still not quite there yet.

I am done up until "settings.php" with necessary folders created and dbs assigned.

Sorry but vhost portion get me puzzled now. Do I have access to Apache conf.? I did a bit of local server setup using Apache a while ago and I know I had access to conf's then.

But now, how do I do this stuff. Guess my host has control over Apache not me. I definitely need some pointers again.

Invest in Yourself!

Visit The Complete Online Business Guide at www.obwiki.net

Multisite Steps - Help with Next Step(s)

Multisite 10 minute Install:

Server: LAMP
SSH/Telenet Client: PuTTY
Must have root access to your server.

If website in question is an addon domain, i.e., addon.mydomain.tld, then substitute "www" for "addon" in steps below.

For list of Linux commands visit: http://www.oreillynet.com/linux/cmd/ or http://www.ss64.com/bash/

Here we go:

[login via PuTTY]

Get to location where Drupal core will be located:

[/]# cd /var/www

Upload Drupal core:

"x.x" should be replaced with the version of Drupal you're installing, e.g. "5.1"

[/var/www]# wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-x.x.tar.gz

Unpack Drupal core:

[/var/www]# tar -zxvf drupal-5.1.tar.gz

Move contents of Drupal core (including .htaccess) to html:

[/var/www]# mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html

Clean-up:

[/var/www]# rm drupal-x.x.tar.gz

[/var/www]# rm drupal-5.1

Create the files directory per Drupal instructions and change permissions (will change permission again after install):

[/var/www]# cd html

[/var/www/html]# mkdir files

[/var/www/html]# chmod 777 files

Make directories that will hold custom and contributes modules and themes:

[/var/www/html]# cd sites/all

[/var/www/html/sites/all]# mkdir modules

[/var/www/html/sites/all]# mkdir themes

[/var/www/html/sites/all]# cd modules

[/var/www/html/sites/all/modules]# mkdir custom

[/var/www/html/sites/all/modules]# mkdir contrib

[/var/www/html/sites/all/modules]# cd ../

[/var/www/html/sites/all]# cd themes

[/var/www/html/sites/all/themes]# mkdir custom

[/var/www/html/sites/all/themes]# mkdir contrib

Create directory "www.mydomain.tld":

[/var/www/html/sites/all/themes]# cd ../

[/var/www/html/sites/all]# cd ../

[/var/www/html/sites]# mkdir www.mydomain.com

Change permission of "settings.php" per Drupal instructions and copy "settings.php" in default to www.mydomain.tld:

[/var/www/html/sites]# cd default

[/var/www/html/sites/default]# chmod 777 settings.php

[/var/www/html/sites/default]# cd ../

[/var/www/html/sites]# cp -rp sites/default sites/www.mydomain.tld

Create database and user with permissions:

[/var/www/html/sites]# mysql

mysql> CREATE DATABASE wwwmydomaintld_drupal;

mysql> GRANT ALL PRIVILEGES ON wwwmydomaintld_drupal.* TO 'wwwmydomaintld_myusername'@'localhost' IDENTIFIED BY 'mypassword';

mysql> \q

Go back to PuTTY to chmod on settings.php in www.mydomain.tld:

[/var/www/html/sites]# cd www.mydomain.tld

[/var/www/html/sites/www.mydomain.tld]# chmod 755 settings.php

[/var/www/html/sites/www.mydomain.tld]# logout

What next?:

  • Make changes to "settings.php" in www.mydomain.tld? I've read that it's not necessary to make changes to setting.php.
  • Make changes to "httpd.conf" in /usr/local/apache/conf?

I've been using WHM to create accounts, putting Drupal in public_html and having no problems. But when it comes to parting from the WHM abstraction and getting multisite set-up correctly this is the end of the proverbial road for me.

Could use help...:

  1. Help making improvements to steps articulated above
  2. Help with next steps so that I/we can get on to grander things, like creating modules, custom themes, profiles, (and maybe - just maybe - spend some time working on business strategy :-)

===
Doug Ouverson
hear | see | say | do | teach

---
Doug | webmaster

Multisite set-up

Multisite set-up

My environment: I lease a dedicated machine that I can configure anyway I like. Here's the basics:

OS: Linux
Web server: Apache
Database engine: MySQL
Page scripting language: PHP
Server GUI: WHM/cPanel

Basically a LAMP server configuration with all the typical hard coatings/set-up.

Other considerations:
*I have root access
*I'm using the ssh client PuTTY. I know most of the commands for doing the majority of server work. I don't use cPanel much if at all since using PuTTY.

Not sure how much info is relevant, but here's what I can tell you:
*I want to run multiple (100s) low->medium traffic sites/accounts off a single drupal install
*The accounts have definite "profiles" groupings: many accounts with profile_1, many accounts with profile_2, etc.
*test site(s) got to have a test site, test sites (per profiles? not sure on this one)
*When creating a new account in WHM/cPanel (as it stands), the main account directory is placed in /home: /home/account1, /home/account2, etc. public_html and other common files, are placed here at account creation time. If anyone needs more specific on directories, documents, permissions, etc. of this basic WHM/cPanel account creation install just ask and I'll share more details.

I can get a complete "non-multisite" Drupal install done in less than 10 minutes, including database creation and many specific common site settings: CleanURLs, changes to permission, site information, theme settings, etc. (what do I want, a pat on the back :-) http://drupal.org/node/130116 but regarding the multisite set-up I don't know the process. I'm sure it's simple, so it should be easy to give directions (according to some it's "no big deal". This is good news!

I also understand what directories are to be created, and where to put them - for a multisite configuration:

  1. /files (required)
  2. /sites/all/modules
  3. /sites/all/modules/custom
  4. /sites/all/modules/drupal-contrib
  5. /sites/all/themes
  6. /sites/all/themes/custom
  7. /sites/all/themes/drupal-contrib

So here I stand (literally). Where do I go from here?:

Question #1: Where do I put the drupal install?
Obviously not where I have been putting them: moving contents of drupal-5.1: /home/account/public_html using the command # mv drupal-x.x/* drupal-x.x/.htaccess /home/youraccountname/public_html. Where should I upload and unpack? "/"?

Question #2: What about the directories in /home/account, which include public_html, public_ftp, etc.?
Do I do anything here? Do I add, subtract, modify anything in /home/account/?

Question #3: After I create the account in WHM/cPanel what do I do next?
I have the Drupal install sitting (or is it setting?) somewhere (Question #1) and I've created a new database with user for this account/site from PuTTY. What do I add, delete, change, modify? and where? I'm assuming this is where most of the "multisite" mojo is happening, and I assume it takes place in location_of_drupal_install/sites/

Question #4: Someone(s) mentioned "vhosts". What, where, how, etc.?

Question #5: What question(s) didn't I ask?

Please fill in the blanks.

Thanks to everyone who's patiently put up with my newbie questions.

===
Doug Ouverson
hear | see | say | do | teach

---
Doug | webmaster

Hope this helps

1. Don't use WHM / Cpanel -- ignore all references to public_html accounts and everything else....if, in my opinion, you want to learn the "basics" of sysadmin, Apache (http.conf file), MySQL (mysqladmin and mysql, plus user creation), and Drupal (install once, basically just manage the sites/ folder)
2. put drupal in /var/www/html (where the contents of the drupal download are unzipped into the html directory)
3. put sites in /var/www/html/sites/domain.com etc. (already listed above) -- each new domain gets it's own folder, it's as easy as "cp sites/default sites/new-domain.com" -- this link may be useful http://support.bryght.com/vps/multiple-sites
4. Configure Apache vhosts as needed, see http://drupal.org/node/278

Alternately, you can check this out using SVN onto your server, where we have this layout already setup and available. See https://svn.bryght.com/dev/wiki/PublicRepository, plus see also http://support.bryght.com/node/536

--
The future is Bryght.

vhost question

I am done up until "settings.php" with necessary folders created and dbs assigned.

Sorry but vhost portion get me totally confused now.

pobster:

Then, simply point all your apache vhosts to the same directory your Drupal folders reside in, eg;

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

Order allow,deny
Allow from all

Order deny,allow
Deny from all

ServerName www.addon1.co.uk
ServerAlias addon1.yourworkgroup addon1
DocumentRoot /var/www/localhost/htdocs

ServerName www.addon2.co.uk
ServerAlias addon2.yourworkgroup addon2
DocumentRoot /var/www/localhost/htdocs

Ensure that your apache is actually set up to have vhosts by the way...

http.conf; (apache2)

Include /etc/apache2/vhosts.d/*.conf

How do I access to Apache httpd.conf? I did a bit of local server setup a while ago using Apache and I know I had access to httpd then.

But now, how do I do this stuff. Guess my host has control over Apache not me. I definitely need some pointers again.

Invest in Yourself!

Visit The Complete Online Business Guide at www.obwiki.net

Understand that all the

Understand that all the vhosts file does is to point a URL at your codebase. If you don't do it this way - then simply do it the way your host told you to do it. As long as when you go to the domain you get taken to the same Drupal codebase, then bingo - that's what you're after. If you have a webhost which does a rewrite to indirectly take you to webspace like this for instance;

http://www.example.com

Shows in the browser but indirectly points you to;

http://www.example.yourisp.com

Then it's still get-round-able, but you have to *know* that's what's happening in order to counteract it.

Another thing to note is PERMISSIONS PERMISSIONS PERMISSIONS.

Rather than simply copy the sites/default/... folder (and contained file) to sites/www.example.com/... use the PRESERVE PERMISSIONS AND RECURSIVE arguments like this,

cp -rp sites www.example.com

If Drupal can't find/ read your folder names then it'll show your default site simple as that. Drupal *always* just does what it's told to do, there's no magic or myth to it...

Pobster

www.example.com or example.com - does it matter?

I read somewhere not to name the directory "www.example.com" but "example.com" not sure why.

===
Doug Ouverson
hear | see | say | do | teach

---
Doug | webmaster

Yes, very much...

#1 and #2 no problem - done.

#3 not sure.

When copying the files from default, is this the command?:

cp sites/default sites/mydomain.com

or is this the command:

cp /var/www/html/sites/default/* /var/www/html/sites/mydomain.com

The later one worked, as the former did not. There's usually mre than one to skin the proverbial cat, so I wanted to check to make sure I was using efficient/lean commands.

Better get past this before working on #4

Thanks, again.

===
Doug Ouverson
hear | see | say | do | teach

---
Doug | webmaster

Basic command line

cp -r sites/default sites/mydomain.com

-r = recursive copy.

Also: if you do example.com, then www.example.com will automatically work, assuming you have DNS set up correctly. monkey.example.com will also work as well (any subdomain will resolve to the parent domain by default, unless there is a separate sites/monkey.example.com defined).

--
The future is Bryght.

Blah...

Hmmm didn't I already tell you about this...

You use;

-rp = recursive copy AND preserve permissions...

Drupal isn't going to be able to see your new folder or the settings.php file if the permissions are wrong. Your current folder is (probably) owned by root with restrictive permissions? Check it using; ls -la sites

BTW, yes as above - I said to use www.domain.com instead of domain.com (which yes, would pick up *everything*) because I assumed that your multisites would be;

www.domain.com
addon1.domain.com
addon2.domain.com

And not what you wrote above... Still either way it doesn't matter, it's irreverent(-ish) to a point.

Pobster

After so much of hair

After so much of hair pulling, I finally dropped the idea of having Drupal installed under it's own directory. I settled with Drupal directly under public_html instead.

Also changed the cPanel domain setup from add-ons to parked ones. I just couldn't get them to work using add-on domain setting.

Finally, managed to get mainsite installed and running plus several parked domains as well. Happy.

I am using 2 domain registrar, say regA and regB.

Somehow later I realise that entering "www.parkeddomain.com" from regB in browser doesn't work. I was taken to regB default page instead. Domains under regA work both ways with or without "www".

What actually comes into play here?

I need some assistance here from you again. Thank you.

Hilmy.

Invest in Yourself!

Visit The Complete Online Business Guide at www.obwiki.net

I don't think I'm entirely

I don't think I'm entirely clear on what you're asking?

...Could you try and explain a bit clearer please?

Thanks,

Pobster

I am sorry! Well the problem

I am sorry!

Well the problem has resolved by itself without me doing anything. So it could have been the "propagation" thing that was the cause as it's a newly registered domain. I am good now.

Sorry for the unnecessary trouble :)

Hilmy.

Invest in Yourself!

Visit The Complete Online Business Guide at www.obwiki.net

Hi Boris, Looking for info on

Hi Boris,

Looking for info on multi-site svn repository layout [link https://svn.bryght.com/dev/wiki/PublicRepository doesn't work]. Really appreciate you to respond. Thx. Lalit

Doug, I would say that

Doug,

I would say that learning multi-site config is more a matter of Drupal's er, notorious documentation problems.

Configuring a new multisite earlier tonight took about five minutes; make a new database, create a new folder in /sites, put a virgin copy of settings.php in the site folder, copy and edit a newsite.com.conf file, restart apache, navigate to the new site and run the install.

That's all there is to it. Unfortunately the current nature of the community means there's a lot out there, and few ways to separate the signal from the noise, and thus it took me hours upon hours to separate out the noise and realize there was a 5-minute process.

And that's from an old sysadmin who learned perms off of 5mb tapes. The excuse that 'its free' gets old; we developed a lot for free 20 years ago and simple good sense kept anyone from releasing anything as poor and inaccurate as the Handbook docs on multisite.

newsite.com.conf file?

One more person struggling with multi-site, I find this last post very promising - 5 minutes!

I'm trying to get multisite organised on my localhost (so no cPanel etc).

ok, I made a new database, created a new folder in /sites, organised the settings.php folder in that file to include the name of my new database and everything.that's usually where the apache-explanations start (I don't understand the "simply make sure all your vhosts POINT to ..." phrase and the like).
now I read here "copy and edit a newsite.com.conf file". sounds good, just that i don't get it either. where should I copy such a file from, and in which sense should I edit it? and where should it end up?

apart from that, thanks to everyone here who's making huge efforts to come down from technical language and to talk to absolute no-knows.

Joris

joris, Sorry not to see this

joris,

Sorry not to see this earlier.

Apache .conf files are generally in something such as \Apache\Apache2\conf\vhosts.d, presuming you have host files turned on.

Drupal Multisite Installation Made Easy

I started this thread nearly 3 years ago. Thankfully along the way I finally found an easy way to Drupal multisite installation which I described in this article:

http://obwiki.net/drupal-multisite-system-easy-way-install-multisite-drupal

I have been using webhosting cPanel to handle the URL redirection. I find it lot lot easier than to mess with symlinks or similar tech stuff.

Need to do standard configurations only - absolutely no techie stuff.

So if you run multiple Drupal-based sites, going multisite route is strongly recommended. It worths many times over the little hassle in the beginning and it's not as difficult as it looks or sounds!

Invest in Yourself!

Visit The Complete Online Business Guide at www.obwiki.net