Drupal 7 开发内部培训资料, 分头诗人

Drupal 7 多站点设置如何实现单点登录?

赞成!
0
否决!

我用drupal 7 建立了多站点架构,如何能做到只登录其中一个站,其他站就不需要重复登录?

1 个回答

赞成!
1
否决!

举例:

假使有两个站点,site1.drupalla.com,site2,drupalla.com

在sites/site1.drupalla.com/settings.php 下面修改代码:

1
2
3
4
5
6
7
8
9
10
11
12
$databases['default']['default'] = array (
   'database' => 'db_site1',
   'username' => 'db_multi_user',
   'password' => 'db_multi_password',
   'host' => 'localhost',
   'port' => '',
   'driver' => 'mysql',
   'prefix' => '',
  );
// Read more about this variables in settings.php
$base_url = 'http://site1.drupalla.com';
$cookie_domain = '.drupalla.com';

 

在sites/site1.drupalla.com/settings.php 下面修改代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$databases['default']['default'] = array (
   'database' => 'db_site2',
   'username' => 'db_multi_user',
   'password' => 'db_multi_password',
   'host' => 'localhost',
   'port' => '',
   'driver' => 'mysql',
   'prefix' => array(
    'default'   => 'db_site2.',
    'users'     => 'db_site1.',
    'sessions'  => 'db_site1.',
    'role'      => 'db_site1.',
    'authmap'   => 'db_site1.',
    'users_roles'   => 'db_site1.',
   ),
  );
// Read more about this variables in settings.php
$base_url = 'http://site2.drupalla.com';
$cookie_domain = '.drupalla.com';