Hello,

I've been searching and reading Posts regarding the Setup for a Multisite sometime now, but don't seem to understand the Basic principle of this whole thing.

I am currently running some sites on my shared hosting account. My aim is to administer these sites under one admin interface, e.g. with one codebase.

Currentlxy I am running these sites with phpwcms.

I've understood the following:

I install drupal on my Hosting account.
For every site I want to add, I put subfolder in the drupal/sites Folder.

example

drupal/sites/default
drupal/sites/anothersite.test
drupal/sites/anothersite_1.test

In the subfolders there has to be a unique settings.php for each site.

Now it gets complicated:

- do I have to set the base_url in the subfolder to
$base_url = 'http://anothersite.test';

- do I have to set the prefix like this:
$db_prefix = 'site_';
$db_prefix = 'site_1_'; etc.

- what address do I have to write in the Browser?
http://drupal.test/anothersite or
http://anothersite.test

- do I have set up vhosts in the apache config ( pretty hard on shared hosting account)

- do I have to use a .htaccess or symlinks? There's nothing in INSTALL.TXT about .htaccess or symlinks.

Please excuse the basic approach of these questions but I'm lost.
All the discussions surround about sub domains, but I don't want to use Sub domains.

I want top have one Installation and then run

digitalearbeit.de
hendrikmartz.de
etc from this code, of course with different theming and stuff.

On my shared hosting account its possible to assign these domains to specific folders on my webspace.

I've tried this

http://drupal.org/node/33581

and it would'nt work, hence would'nt setup tables for a new site..

I've installed some stuff in the past, but with this cms I'm a little lost.

regards

bossy

Comments

DVV’s picture

As a new drupal user I had the problem as you with multisite configuration (and I still have).

After reading a lot of postings from here and understanding practically nothing I finally used a quick and dirty solution: I've installed two instances of Drupal in two different places on my server using the same database. It works perfectly and solved all my problems of having two separate sites with separate settings etc. As far I could observe till now there were no disadvantages/problems by having two drupal installations with the same database.

So I have now the two installed drupals at

www.myserver.com/myfirstsite and
www.myserver.com/mysecondsite

and I use these two different addresses to reach the two sites. (At least untill I understand how multisites feature really works :->)

Hope this helps you somehow

bossy22’s picture

Hello GIgi...

thanx for the reply.
Thats a solution, but a solution lika that, I have now, with three Sites and three Installations of a CMS.

One of the main reasons I choose Drupal was because I want to administer all those Site under one webinterface.

Maybe I start by installing it and use it for one website.

But one more Question:

I had to upload the database.mysql file. I suppose u had to, too. Is there no conflict of ur two installs in one database?

do u use same content? did u chosse another table prefix?

regards

bossy

####################

made some progress.

I've added a vhost to my httpd.conf for the ServerName
hendrikmartz.test

also in /etc/hosts

when I call this adress, I get this:

Table 'drupal.hm_users' doesn't exist query: SELECT u.*, s.* FROM hm_users u INNER JOIN hm_sessions s ON u.uid = s.uid WHERE s.sid = '70c22e651b650b81f7c00e6e3b144884' AND u.status < 3 LIMIT 0, 1 in /home/hoth/work/cms/drupal/drupal/includes/database.mysql.inc on line 66

That's probably because I ran the database.mysql once without the table prefixes.

Do I have to make a copy of the database.mysql and add the prefixes myself?

regards

bossy

DVV’s picture

till now there were no conflicts.

I have only ONE mysql table (so no prefixes or something) and I choose through a different set of links (hardcoded through the template) which pages (what content) I show on every site.

The most utilities (forum, chat) are common/identical since the two sites (and their users) are related.

I know, I know, this solution is probably outrageous for an experienced drupaler but I am just a newbie who was looking for a quick and easy way to solve a problem.

oneighty’s picture

I've got a multi-site setup (sharing a couple of tables ... but that is a whole different kettle of fish). Bascially I have a "Main" site and then a couple of subdomains, all running on the same Drupal installation, on a single domain (at the moment on my localhost).

So ...

Lets say you have three sites you want to get running under a single Drupal installation, namely:

The first thing to do is create and configure the various settings.php files in the "sites" directory. So in this case you'll have three setting.php files as follows:

  • ../DRUPAL DIRECTORY/sites/www.example.com/settings.php
  • ../DRUPAL DIRECTORY/sites/test.example.com/settings.php
  • ../DRUPAL DIRECTORY/sites/dev.example.com/settings.php

... now that was pretty easy, the next we go to the Apache configuration file (APACHE DIRECTORY/conf/httpd.conf) and configure the Virtual Hosts

    NameVirtualHost 127.0.0.1:80
    <VirtualHost 127.0.0.1:80>
    DocumentRoot "APACHE DIRECTORY/htdocs"
    ServerName localhost
    </VirtualHost>

    <VirtualHost www.example.com>
    DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
    ServerName www.example.com
    </VirtualHost>

    <VirtualHost test.example.com>
    DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
    ServerName test.example.com
    </VirtualHost>

    <VirtualHost dev.example.com>
    DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
    ServerName dev.example.com
    </VirtualHost>

Check out this Node, it has a lot of comments, but contains what you are probably looking for.

bossy22’s picture

hello,

thanx for the reply.
But that was exactly what I didn't mean.

who has access to a httpd.conf on shared hosting account???

And I read everything in that node, only to be more confused than before.

thanx

bossy

bossy22’s picture

...

I've loaded another mysql dump into my database, with hm_ prefixes. The same prefix is written into

$db_prefix in the settings.php in my subfolder in sites.

When I try to reach the site I get a

"Page not found" Error.

When I do a reload, I get this:

Fatal error: Duplicate entry '70c22e651b650b81f7c00e6e3b144884' for key 1 query: INSERT INTO hm_sessions (sid, uid, hostname, timestamp) VALUES ('70c22e651b650b81f7c00e6e3b144884', 0, '192.168.0.30', 1133454359) in /home/hoth/work/cms/drupal/drupal/includes/database.mysql.inc on line 66

I dropped the table hm_sessions a couple of times, and reinserted the sql.

But everytime I get the same Message.

regards

hendrik

bossy22’s picture

...any Idea on my Problem?

I'm kinda stuck here.

thanx

bossy

BoogieBug’s picture

What I did is creating a symbolic link of the root directory to the subsite's direcoty.

For example:

You have a main site built in directory /home/user/public_html and your httpd.conf create a vhost in /home/user/public_html/site1, you just create a symbolic link with the name of "site1" to the /home/user/public_html.

This can be done by a small script like:

<?php

$links = array("site1", "site2");

$root = dirname(__FILE__);

foreach ($links as $domain)
{
  echo "creating symbolic link for $domain ...";
  flush();

  if ( symlink($root, $domain) )
  {
    echo "success!<br>";
  }
  else
  {
    echo "failed!<br>";
  }
  flush();
}

echo "Done!<br>";

Well, this works on Unix-based system only.

Jacob Lee Anawalt’s picture

- do I have to set the base_url in the subfolder to
$base_url = 'http://anothersite.test';

The $base_url for a multi-site is set like it would be in sites/default for a single site. It's the url by which you access that page.

I would expect that for digitalearbeit.de, $base_url='http://digitalearbeit.de' in sites/digitalearbeit.de/settings.php

Jacob Lee Anawalt’s picture

- do I have to set the prefix like this:
$db_prefix = 'site_';
$db_prefix = 'site_1_'; etc.

If your hosting provider only gives you one mysql database, then yes, you would need to prefix your tables if you don't want them shared between the sites. If you have multiple mysql databases then you don't need to prefix your tables.

Jacob Lee Anawalt’s picture

- what address do I have to write in the Browser?
http://drupal.test/anothersite or
http://anothersite.test

- do I have set up vhosts in the apache config ( pretty hard on shared hosting account)

- do I have to use a .htaccess or symlinks? There's nothing in INSTALL.TXT about .htaccess or symlinks.

This part is probably the hardest to document since there are so many variables.

You are able to assign your domains specific folders in your "webspace". Are you able to assign them the same folder?

Given the folders

$HOME/webspace/
$HOME/webspace/digitalearbeit.de

Is it possible for $HOME/webspace to be the document root for hendrikmartz.de, or is "webspace" where you put folders for http document roots?

If you can assign them all the same folder, I would set $HOME/webspace/drupal to be the document root for all sites. Then as you access them through your browser via http://hendrikmartz.de and http://digitalearbeit.de, Drupal will do the right thing and serve the right site. You shouldn't have to (directly) mess with your apache config or do symbolic links.

Jacob Lee Anawalt’s picture

I am currently running some sites on my shared hosting account. My aim is to administer these sites under one admin interface, e.g. with one codebase.

Without getting more advanced and sharing some tables you will have an admin interface per site. You will only have one codebase installed and can do per site themes, but the content and administration of content is database driven.

bossy22’s picture

... for ur posts.

Its been a month since I posted my problem.

So it has been an absolute coincidence that I found them today.

I will try ur suggestions and get back to u.

bye

bossy

JZ clarke’s picture

I have repeatedly tried to set up multisites with no success. now that i have a complex and interlinked set of modules and themes which i want to use with multiple sites it ismore imprtant for me to get this working instead of doing as above and having multiple drupal installations.

The isp allows the creation of subdomains through CPanel. Once set up they create a folder in public_html but nothing happens when you go to the subdomain address

how do i do the equivalent of the apache commands below in CPanel or what simple instruction can i give the ISP.

i notice that if i set up a redirect in the subdomain it creates an htaccess file
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.myexample.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.myexample.org.org$
RewriteRule ^(.*)$ http://myexample.org [R=301,L]

could i rewrite that to accomplish the "symlink" or pointer back to the drupal code?

Thanks
jess

. now that was pretty easy, the next we go to the Apache configuration file (APACHE DIRECTORY/conf/httpd.conf) and configure the Virtual Hosts

NameVirtualHost 127.0.0.1:80

DocumentRoot "APACHE DIRECTORY/htdocs"
ServerName localhost


DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
ServerName www.example.com


DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
ServerName test.example.com


DocumentRoot "APACHE DIRECTORY/htdocs/DRUPAL DIRECTORY"
ServerName dev.example.com