The document discusses multisite and single sign on (SSO) in Drupal. It explains that multisite allows creating multiple sites using a single Drupal installation and codebase, sharing code and improving management. SSO allows users to log in to one site and be automatically logged into other sites that are configured for SSO by sharing user, session, and role tables between sites. It provides instructions for setting up a multisite Drupal installation with SSO between two sites by configuring the database, settings.php file, and installing Drupal.
2. Who am I?
Ipsita Mishra
http://drupal.org/user/172344
IRC Nick: ipsita
Currently working for Melity Inc in association with PCI Hyderabad
3. We will walk through
What is Multisite?
How to setup Multisite
Sharing information between Multisite
4. WWW
What is multisite ?
Using a single drupal installation(code base) for creating
multiple site.
Why go for it?
What is assumed?
5. WWW
What is multisite ?
Using a single drupal installation(code base) for creating
multiple site.
Why go for it?
Shared codebase means all sites are using the same
version(latest version, probably). Better server(site)
management, less complex version control system, less
management for Security Issues.
What is assumed?
6. WWW
What is multisite ?
Using a single drupal installation(code base) for creating
multiple site.
Why go for it?
Shared codebase means all sites are using the same
version(latest version, probably). Better site management, less
complex version control system, less management for Security
Issues.
What is assumed?
You have basis knowledge of Apache server configurations &
default drupal folder structure.
7. Mutlisite vs. Multiple sites
www.example.com www.example.com
Drupal Code
www.example.com/site1 Drupal Code
www.example.com/site1
Drupal Code
www.example.com/site1
site2.example.com
Still we can keep
uniqueness of each Drupal Code
site
8. Mutlisite vs. Multiple sites
Credit : This is a snapshot from the Video on Multisite by Matt Petrowsky
16. What is Virtual host?
The term Virtual Host refers to the practice of
maintaining more than one server on one machine, as
differentiated by their apparent hostname. -
apache.org
Virtual hosting is a method for hosting multiple domain
names on a computer using a single IP address. This
allows one machine to share its resources, such as
memory and processor cycles, to use its resources
more efficiently. - Wikipedia
19. Drupal lookup for settings.php
Our website: friends.example.com
Drupal will search for configuration files in the following
order, using the first configuration it finds:
sites/friends.example.com
sites/example.com
sites/default
20. Drupal lookup for settings.php
Lets take a complex example :
www.sub.example.com/site3
Drupal will not read configuration from
sites/sub
sites/site3
21. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
22. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
23. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
24. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
25. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
26. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
27. Drupal lookup for settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for
configuration files in the following order, using the
first configuration it finds:
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
sites/default/settings.php
28. Single Sign On(SSO)
SSO means when you created a user/pass on
one site, it will work on the other site(s)
29. Single Sign On(SSO)
SSO means when you created a user/pass on
one site, it will work on the other site(s)
These sites will share session and user-related
tables so once users login to one of the sites, they
will auto login to the other site without logging in
exclusively.
30. Single Sign On(SSO)
SSO means when you created a user/pass on
one site, it will work on the other site(s)
These sites will share session and user-related
tables so once users login to one of the sites, they
will auto login to the other site without logging in
exclusively.
In addition to that, we can share User roles and
profiles among the two sites.
31. Prepare database and user(for SSO)
# DB name: drupal_db
# DB username: duser
# Password: duserp
32. Modify settings.php
Open settings.php in the folder
sites/news.example.com/
$db_url = 'mysql://username:password@localhost/databasename';
change it to,
$db_url = 'mysql://duser:duserp@localhost/drupal_db';
33. Modify settings.php : $db_prefix
We have a variable called “$db_prefix” which will
do the magic
Since we want to share a database among two
sites but not completely, we decide which tables
to share / not to share.
35. Now edit the settings.php file for
sites/sn.example.com
Use the same database connection information.
$db_url = 'mysql://duser:duserp@localhost/drupal_db';
Then, you add an array of prefixes, which will look like:
$db_prefix = array(
'default' => 'sn_',
'users' => 'shared_',
'sessions' => 'shared_',
'role' => 'shared_',
'authmap' => 'shared_',
'users_roles' => 'shared_',
);
37. SSO for two websites with 2 database
An option : Multisite Login Module
# Using a multisite installation.
# Using a separate database for each site (no table prefixing,
though the code could be modified to allow for this).
# Share the users table across all sites (If this is not you, what
are you hoping that this module will do for you?)
# You need to install the Multisite Api module.