Ok, i have searched thru the forums, but every possible answer is diferent to what i am looking for. I am hoping to find a link that would explain all possible scenerios for a multisite installation. I am testing my server locally for now.

I am developing more than 2 web sites that i would like to run on one drupal installation, here's my scenerio:
http://localhost/mainSite/
http://localhost/mainSite/site2
and so on. I would easily install drupal for everysingle site, but that's not the best approach, i believe.

in the "sites/default/settings.php"
i have sites/site2/settings.php

In the site2, i have edited the settings file to match my site. When i tried to view the http://localhost/mainSite/site2 page, i get a page not found, is correct because there is no site2 folder, there's no index.php!
Do i need to create a folder for each site, like so:
mainSite/all drupal files
mainSite/site2/all drupal files?

I am confused, i need some guidence for multisite installation for drupal 4.7, if you know anly link in regards to muliSite installation, let me know.

thanks in advance.

Comments

heine’s picture

It helps to recognize that there are two parts to multisites:

  1. Getting the webserver to load the same index.php for multiple sites (domainnames, directories)
  2. Configuring drupal

1. Getting the webserver to load the same index.php for multiple sites

I will assume
- Apache
- Windows NT flavor (XP, 2000, etc)

This can be achieved by

1. Virtual hosts pointing to the drupal installation directory
2. Aliases pointing to the drupal installation directory
3. Symbolic links guiding the webserver to the drupal installation directory (in your case site2 would be a symbolic link to mainsite)

To develop sites locally it is usually best to use subdomains on localhost (site1.localhost, site2.localhost) as this can prevent a lot of link problems later when you have domain1.com, domain2.com etc. So I'll use that as an example.

Here's a sample / simple Virtualhost configuration for XAMPP (usually goes into httpd.conf (for xampp extra/httpd-vhosts.conf):

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"  # Default XAMPP htdocs
</VirtualHost>

<VirtualHost 127.0.0.1:80>
ServerName site1.localhost
DocumentRoot "c:/drupal_installs/drup_47"   # Drupal installation directory
    <Directory />
      Options All
      AllowOverride All        # Simply allow all directives to be overridden in .htaccess
      Order allow,deny
      Allow from localhost     # Only allow access from localhost
    </Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:80>
ServerName site2.localhost
DocumentRoot "c:/drupal_installs/drup_47"    
    <Directory />            
      Options All
      AllowOverride All      
      Order allow,deny 
      Allow from localhost 
    </Directory>
</VirtualHost>

Always restart Apache after changing the configuration.

Of course, the OS needs some persuasion to resolve the domainnames site1.localhost and site2.localhost to 127.0.0.1.

Open %windir%\system32\drivers\etc\hosts and append

127.0.0.1 site1.localhost 
127.0.0.1 site2.localhost 

Most unices also carry a hosts file in etc.

Check that Apache loads drupal for site1.localhost & site2.localhost (error pages).

2. Configure Drupal

Create in the drupal installation directory the directories:

sites\site1.localhost
sites\site2.localhost

Copy the default settings.php into those directories and adapt the $db_url and $db_prefix variables.

For your situation, create one database and load the database layout twice, each time with the desired prefixes.

Your multisite installation should be working now.

ps: while tempting to multipost, better put all info in one place.
--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

hectorplus’s picture

Thanks for your help, i will attempt to follow your instructions. If things fail, i have no choice but to create separate folders for each site, rather than pointing to the same index.php, it till have its own drupal files, running the same database, i hope it works.

Sorry for the double post.


tecito.com


Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.

alonpeer’s picture

I don't have access to change my httpd.conf, only the .htaccess files.

I already have a running drupal 4.7 site at http://www.example.com, and I wish to have another site with the same drupal installation but different modules and themes at http://www.example.com/site2.

I created sites/www.example.com.site2, and copied settings.php into it from sites/default. I editted the file, unmarked and updated the line: $base_url = 'http://www.example.com/site2'; // NO trailing slash!.

I'm trying to access http://www.example.com/site2, but I get a Drupal not found page.
If I understand correctly, it means that my drupal installation index.php is loading, but it's not recognizing the site2 I configured.

What am I doing wrong?

heine’s picture

You need to point Apache to index.php in such away that index.php sees it is called via http://www.example.com/site2.

As you have virtually no control over your server, this means that you have to create a site2 symbolic link back to the drupal installation directory.

drupal_install/index.php
drupal_install/site2 -> symbolic link to drupal_install

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

hectorplus’s picture

I am clueless here, wha and how does symbolic link work?

I have the same sitution:
I get a page not found, it does not load the settings from the second site.


tecito.com


Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.

imstevecho’s picture

If you use Windows check out this document.
http://drupal.org/node/31489

You can download Junction to create a symbolic link under Windows system.

Joyvill web design in Toronto Canada

TheFazz’s picture

post to subscribe to thread.

http://www.my-kart.org/

glenng’s picture

Pls delete this post

mi-sjo’s picture

Reading through "all" comments regarding multi site setup leaves us somewhat confused, as it seems to be many different solutions for this issue.
What we would like to accomplish is this:
- one main site (portal for a number of organizations)
- a number of "subsites" (organization sites)

Each subsite will have it's own users, themes etc i.e. much of a standalone website, but some content may be shared from main portal to every subsite.
All sites will have ads and other "site specific things" so we think of using one database, with prefixed tables to get stats, design and users separated from each subsite.

Example:
www.mainsite.com
- membersite1
- membersite2

The URL:s for membersites are not that important as long as they can be reached directly i.e. ~membersite1.mainsite.com or ~mainsite.com/membersite1.

What would be best to accomplish this? Multi site setup, one database or many?
BTW: as of now we do not have full controll over the web server..

A pointer to any good documentation describing this scenario would be highly appreciated (running Drupal 5 now).

mi-sjo

rmpel’s picture

I'm trying to accomplish the exact same thing.

Here's what I done so far:

drupal_base/[drupal 5 installation]
drupal_base/mastersite -> drupal_base (symlink)
drupal_base/member -> drupal_base (symlink for member)

drupal_base/sites/default/settings.php (settings of main portal)
drupal_base/sites/domain.tld.mastersite/settings.php (settings of mastersite; here I want to post the shared content)
drupal_base/sites/domain.tld.member/settings.php (settings of member; this is the actual member site)

Ofcourse, member will be around 110 sites

In settings.php I declared a prefix for all members, except for these tables;

aggregator_category, aggregator_category_feed, aggregator_category_item, aggregator_feed, aggregator_item, banner, blocks, blocks_roles, boxes, contemplate, filters, filter_formats, formbuilder_form, locales_meta, locales_source, locales_target, menu, permission, profile_fields, profile_values, role, smileys, sessions, taxonomy_context_term, taxonomy_context_vocabulary, term_access, term_access_defaults, term_data, term_hierarchy, term_image, term_relation, term_synonym, userpoints, users, user_badges_badges, user_badges_product, user_badges_roles, user_badges_user, views_bookmarks, views_bookmark_nodes, views_bookmark_nodetypes, views_bookmark_node_count, view_argument, view_exposed_filter, view_filter, view_sort, view_tablefield, view_view, vocabulary, vocabulary_node_types, webform, webform_component

The idea is; 1 user database, 1 taxonomy database, 1 user-role database
But; a member only has editorial rights on his own site (users_roles table not shared)

For shared content i was thinking about using the aggregator tables.
The mastersite aggregates his own content regularly via RSS on himself. Because the tables are shared, the membersites automatically have this content as well. This way content is not duplicated but still widely available and maintained on one site only.

In my setup usernames are identical to subsite names. (I developped a module to alter the profile settings form on the mastersite in a way that the users is able to change his/her site-theme by editing his profile on the mastersite. This is to avoid having to use the theme selection (admin/build/themes) itself. (also a lot of other settings will be managed in this way, but that is classified :P)

The problem I ran into is that even though the member has editorial rights to add content; the page node/add shows 'no content types' on the member site and when logged in with superuser node/add/page results in a blank page.

Hope this helps you one step closer to a solution and at the same time maybe you'll find a solution to my problem :P

Keep in touch!

Remon.

robsteranium’s picture

I've replicated these steps (symlink and copy of settings.php as per URL) and my default and other site appear to function. They appear to both contain the same content. How do I keep the content separate for each multi-site?

robsteranium’s picture

Oops!

Just realised I needed to specify a db prefix in settings.php and run install again.