国外设计欣赏网站 - 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& _' n: H- F( k- B* e$ n+ e$ H* _
2
8 S! B+ v* O! e) u8 S  i  t) \) k$ `3
; m. g1 z, f# i# Y4: s& i' r* w( f$ x
5- _1 |; K! I. J
64 [6 I# B7 v  l$ _2 O) }
7% O8 @& @  Z  T/ L  u4 a) o
8; R! o5 T/ L7 _( R& u4 o/ W+ y1 y
96 W9 Z1 x6 f  ]
10. ]" c* o  F' `6 N9 P% z) S
11
% T: I9 v; p& ]. L% \" D12
1 D) A5 R* ^8 h  Q" R' g8 L5 h
$databases['default']['default'] = array (* r. S$ z( Z& p! m
   'database' => 'db_site1',2 l4 X  c" S) a, w% a
   'username' => 'db_multi_user',
4 @% C, q1 k# E1 |8 x1 C, ^/ F5 I   'password' => 'db_multi_password',) |, V1 g2 e( z" T, A
   'host' => 'localhost',2 j9 Z6 ^; b3 j4 }0 @" }) }- H
   'port' => '',
3 N2 k& E' y# n9 c   'driver' => 'mysql',5 k- X3 V( J+ y
   'prefix' => '',
8 ]; `' M# c9 M5 W! I1 j+ G  );, |7 ]7 O" d% U4 s( l
// Read more about this variables in settings.php
/ Y4 b9 x! K- Q1 f* x# W3 Y8 \+ E$base_url = 'http://site1.drupalla.com';  t5 d! z' M) t" j) b
$cookie_domain = '.drupalla.com'; // 这段能让网站单点登录,前提是多站点都是同一个域下的二级域

 

 

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

1! l$ \7 R5 W$ M: W  u0 T
2
, H: t, Z, s7 f+ m38 E4 i& w2 C; l  y3 M: }3 T
4: s( y8 g1 D2 S- Z+ s2 u
51 c' b" W" Y4 x& M4 `* s4 Y5 S
6
# `% u1 Y  A8 p71 h* q4 Q6 ~5 k, P$ B9 d7 ?
8
9 j3 n! j' F) o$ z$ B4 o1 R# w9
% A0 v/ h4 j3 A9 q. A7 N, `9 w, X10' Q6 y! c7 R2 o
11
% Q5 X1 x+ q: ]' R7 \+ h12/ p4 }% q1 y$ t1 x
13$ ~) H9 g5 q4 ]/ H5 n
14
" y0 U, }5 r/ V* K. s7 j6 G15
& |0 D  t, Q$ T16
' Z4 i% E7 n: {" x, e17
5 O& c* M5 O3 o2 i18
1 J) w& [; U+ k+ Z3 H, o3 |% Y3 [19( E) Y' |* U& d( d4 u* o$ b
$databases['default']['default'] = array (
' H! r( ]" m* p; b0 x# f7 W   'database' => 'db_site2',
( e( O% s' e, o% X  Q0 c   'username' => 'db_multi_user',$ \# `1 U& Z! W5 r5 l6 f3 u8 I) D
   'password' => 'db_multi_password',- K* f! L: b$ L+ _4 O' h3 y+ V, J
   'host' => 'localhost',
' J' Q9 b9 o7 D   'port' => '',
5 y! w1 N- S. S& W   'driver' => 'mysql',) Y$ U: S+ s" S) _" k5 e
   'prefix' => array(# }' y, j, }" f# c' x1 M: f
    'default'   => 'db_site2.',6 M& F! J0 u# ]$ V) i
    'users'     => 'db_site1.',
$ Y1 U2 A% s' S4 M5 n" h    'sessions'  => 'db_site1.',
/ c' c  B. t; K    'role'      => 'db_site1.',
! K7 c/ v; Z$ m1 B4 F: i$ y    'authmap'   => 'db_site1.',
, ]' b$ u1 N" E1 {! s; r    'users_roles'   => 'db_site1.',1 P4 j2 G, @( V2 ^7 {! K
   ),+ q' y# H7 a, `% |
  );
& O9 B7 f$ d2 p: o! C8 r& z7 B// Read more about this variables in settings.php9 ], V" i  H3 E/ s
$base_url = 'http://site2.drupalla.com';4 _* }2 g9 Y( ~+ r6 s8 I  a
$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, 5-1-2025 07:11 , Processed in 0.368354 second(s), 164 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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