国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal教程] drupal 7的多站点设置方案

[复制链接]
发表于 5-30-2012 22:00 | 显示全部楼层 |阅读模式

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

首先复制sites/default -> sites/site1.drupalla.com      sites/default -> sites/site2.drupalla.com
在sites/site1.drupalla.com/settings.php 下面修改代码:

1
& i  }- T! Q4 u! m7 f2
) H- ?$ l+ b) y3
5 Y& T6 V/ P* S& b/ l$ l' ~$ I49 M. I$ z, @7 f* O7 T
5: q% F% D1 U- _- E1 N, e; W6 q
6
3 r) Z  L4 B* }4 n( D' L/ g* L; Y7
+ @3 S8 l7 Y4 `7 V! X& o1 o8( U8 K  |3 V7 S( y1 s) ^- }5 ~
9/ S: m5 n' F0 c* I, Y1 O4 y/ {
10
+ V) A6 y9 t' C# H6 _# n# \11
9 ~4 i# K! ?6 @+ b% Z- N! F2 U& l12
3 }2 z% V2 n7 ~4 K' H: @. F% j
$databases['default']['default'] = array (6 \& P( u* f. T! H# |8 R
   'database' => 'db_site1',
' `8 _( G7 ?( z   'username' => 'db_multi_user',
3 o$ D& ?* \' V( G, b& E( z   'password' => 'db_multi_password',
- d) J# X1 y1 F   'host' => 'localhost',
7 L* t! Q, B( |: u6 Q- \   'port' => '',9 p0 q  v& r% {( T  A/ y3 M* N' E- L
   'driver' => 'mysql',
5 O" o: q( D: E) k) q9 D   'prefix' => '',2 }. {3 r( v; a) u1 a0 ~, {4 P  }' Y
  );
6 D3 I7 }. ~# D3 d+ ]! }5 N// Read more about this variables in settings.php
3 I: F, f  j5 A, @: y$base_url = 'http://site1.drupalla.com';9 g. z% P% a% m* w0 T
$cookie_domain = '.drupalla.com'; // 这段能让网站单点登录,前提是多站点都是同一个域下的二级域

 

 

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

1, v' Y; l" w  `1 ~
2$ D% h: E+ J1 K7 q8 W; g
3
, G6 g5 Q2 |1 u5 T/ ^4
: ~+ u) y: E. e) e5: K0 G, f3 i3 z# @% A
61 E4 z, |/ S5 e; c9 |% M1 ^
7
3 C3 M. w+ T0 h4 y8
5 V0 n% `& H& O1 n  e- d4 |9' c* Q7 I* `3 E4 n# Q
10
) l- Y+ s, A' Z; P- j0 T11% g1 M8 u+ \/ s8 `5 ]+ r: T
12' E2 [) v) V3 |: N6 w9 e  }
13
1 z' g- J1 [/ y  ?" u+ I142 P3 v4 e9 I+ L% o$ g3 ^" d
15
& b. Z, K2 p2 X7 A16
) Y7 ]$ T( c& ^% R# W17
7 W+ @! y2 |- E% w2 }186 w; m% Y+ H% F1 F
19
3 o( o! R2 D; J8 B  \& E
$databases['default']['default'] = array (
% N, k- H5 p' |  K% o   'database' => 'db_site2',8 i4 P8 I8 Z6 B8 }2 W1 `% l
   'username' => 'db_multi_user',9 Q2 M0 ]! f. k( F' ~9 O7 e4 T
   'password' => 'db_multi_password',, ~( z+ L* N. ]" Y% \7 P
   'host' => 'localhost',/ \: ]+ P0 P, `2 o* W! ^3 @# I
   'port' => '',- o0 o; i7 `2 [! [
   'driver' => 'mysql',$ a2 l% I2 {5 L. d
   'prefix' => array(4 Z) n5 e# w6 c1 \( V6 o+ r) s2 Q
    'default'   => 'db_site2.',
: _8 m( b+ i; r$ {- ]  D    'users'     => 'db_site1.',3 q6 C; F' ~6 N6 x, N: o/ k
    'sessions'  => 'db_site1.',6 N7 }# A. |- @5 r3 ]  E! m
    'role'      => 'db_site1.',
5 g0 j8 q/ [0 a$ {    'authmap'   => 'db_site1.',8 d- G2 ]+ U8 q: K* R# F! n
    'users_roles'   => 'db_site1.',
% ^- X; q$ u4 [" _4 B$ ~   ),! d! V, }3 W- k) d  `4 ?2 Q* p, |
  );
6 E! t8 S" s: Z/ l// Read more about this variables in settings.php3 ~: f0 W$ |+ t6 I6 C$ r
$base_url = 'http://site2.drupalla.com';+ _, X" M( T  }; ^3 [) A: d
$cookie_domain = '.drupalla.com';

 

确保两个站点的文件夹sites/site1.drupalla.com,sites/site2.drupalla.com权限是666

确保sites/site1.drupalla.com/files,sites/site2.drupalla.com/files权限是777

 

site1.drupalla.com , site2,drupalla.com 指向服务器ip, 成功后,浏览器分别打开site1.drupalla.com 安装, site2,drupalla.com 安装



本文选自:猪跑啦,谢谢诗人!

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 4-16-2025 18:10 , Processed in 0.355962 second(s), 163 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表