国外设计欣赏网站 - 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; @4 C- a2 e2 y
2
7 B$ W4 n4 A0 c9 `( x: z3
3 U7 z/ b: T7 o5 x: w* m1 |0 A) ]  M4
$ ^3 I1 v( H$ {# b0 [5! q& R" O" W, R! F/ P# M' P
63 z  L$ N4 p# U5 g5 G, {& c7 K
7
! q- C3 s. n  Y' U" Y' p4 f9 [' A- [8
# Q/ s" x- h9 v4 z9 c9
* i# C. Z4 v3 i; V- s; a2 C" b  z100 L0 Z! I3 s2 n# y) j( Q
11, C3 G3 v( a6 w
12
& K, }6 C) w- X# l$ A/ V
$databases['default']['default'] = array (! M9 G! W& f! l1 o! e% F
   'database' => 'db_site1',
2 ]! H1 D2 ^5 t   'username' => 'db_multi_user'," `/ o  u! i9 s; f9 e. H
   'password' => 'db_multi_password',/ t* K7 F- U5 t  x( @' D; p+ B
   'host' => 'localhost',; l, g# m" y9 q8 ^3 f) A! ^
   'port' => '',
  h: @" m1 ]6 f9 N+ q   'driver' => 'mysql',
- O" [/ h6 l- y   'prefix' => '',+ p8 I' \8 `) ~
  );0 F! x( j4 m7 T: X5 Q/ _& _  ]
// Read more about this variables in settings.php
5 E8 L5 U) h3 o$ x4 x: w/ z! r$base_url = 'http://site1.drupalla.com';! r! _7 v; g. H  a2 e% u
$cookie_domain = '.drupalla.com'; // 这段能让网站单点登录,前提是多站点都是同一个域下的二级域

 

 

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

1
- Y1 C( r0 E6 G3 T- W7 G20 w( ^+ P2 E8 d5 b" J
3
( }) ?! ]% G  {$ D  k! L4 ^4" m" i  h3 N2 u' l
5
% j* A7 l; l, T3 l1 I+ P6
0 `& ]$ ?6 x* g+ w' w1 w2 v7 ~7
/ C* g( C8 |" ~7 J* v, T5 x85 F+ m# B& b, H& f
9
8 V; s6 p) P! Y) F10
* r+ E, y1 J; e4 z6 P) H) [/ \11$ k2 f1 e3 E0 G  F
12
; ~; d! C8 s: ~, }13# F% F# P& g8 ~1 r; `: m: E
143 {$ K2 R) T- Y9 Z, v# H
15! w* B/ j, }- y0 R. T. C
16) S# o, Z0 `: [8 }0 x6 p, x" r. G
172 r/ q# A% q9 O4 |8 o% n2 T
18- p. i. F. a3 c' {0 Y
19/ ^3 M. C' z( l
$databases['default']['default'] = array (7 k. r7 i! l" v# ]7 M( o; L/ ^1 I
   'database' => 'db_site2',) o- c1 O' B/ Q4 g4 H% g
   'username' => 'db_multi_user',* Z9 j/ p3 n/ X5 R! }7 V
   'password' => 'db_multi_password'," J- D: ]5 O* P+ I8 g
   'host' => 'localhost',: C& R# O6 T* Z: N& A1 W  I' x' H
   'port' => '',
* c: p9 ?$ s, f( I$ \5 W9 u   'driver' => 'mysql',* J* F# P7 k$ k, q
   'prefix' => array(
" J7 N( `1 f: ?    'default'   => 'db_site2.',
% ^2 J) t* }4 x5 ^    'users'     => 'db_site1.',. \3 O( r4 s, v# a
    'sessions'  => 'db_site1.',
) Z  e8 M, L# K3 |  L4 [$ J; f    'role'      => 'db_site1.',0 m0 M0 @4 n( _3 r8 ^
    'authmap'   => 'db_site1.',7 V& ^- Q, g! L8 q: O
    'users_roles'   => 'db_site1.',
, v- @7 n8 V: L) @% S   ),
- ?( u( o+ Z( L. X( _$ I9 ^; V  );
# c1 n5 {5 f0 l1 Q  N$ _7 f& T  u, K// Read more about this variables in settings.php1 T% W3 i" ^0 ^" _9 H$ s# E
$base_url = 'http://site2.drupalla.com';
3 e5 L: g5 Q* D8 x# ]$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, 2-15-2025 01:10 , Processed in 0.697674 second(s), 170 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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