Drupal Multisite Setup

  • 5,461 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,461
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
113
Comments
1
Likes
5

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Multisite & Single Sign On by Ipsita Mishra
  • 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 
  • 9. Multisite Structure
  • 10. Multisite Structure
  • 11. 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
  • 12. localhost /etc/apache2/sites-available/default The `default` file is read when we type http://localhost in our browser vhost (an example file) /etc/apache2/sites-available/news.example.com
  • 13. A Sample Virtualhost Configuration
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. 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
  • 20. 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
  • 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 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
  • 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 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
  • 23. Single Sign On(SSO) SSO means when you created a user/pass on one site, it will work on the other site(s)
  • 24. 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.
  • 25. 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.
  • 26. Prepare database and user(for SSO) # DB name: drupal_db # DB username: duser # Password: duserp
  • 27. 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';
  • 28. 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.
  • 29. Modify settings.php : $db_prefix $db_prefix = array( 'default' => 'news_', 'users' => 'shared_', 'sessions' => 'shared_', 'role' => 'shared_', 'authmap' => 'shared_', 'users_roles' => 'shared_', );
  • 30. 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_', );
  • 31. Install drupal http://news.example.com/install.php http://sn.example.com/install.php
  • 32. 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.
  • 33. Resources http://drupal.org/getting-started/6/install/multi-site http://gotdrupal.com/videos/multisites-vs-multiple-sites http://groups.drupal.org/multisite
  • 34. Thank you