国外设计欣赏网站 - 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. D; D: V: h5 x
2
" r: D( \* o/ M- i3 ^0 y/ _3
' w# Y1 n! L9 @  w7 [1 y& b: X2 z4
. O! L  {5 \  r) b$ M( K4 e7 I5% x9 s" P0 G1 n  c- [+ N4 k6 ]8 i* Z
6
$ W' w2 M5 Y7 m7 X" r# E8 G# t7$ u/ w  S  Q. o% v$ l" `* F
8
. Z) L, E7 I+ N, f95 i# D. J( R$ E  }2 {  F( L
10
$ p6 q& ~% L4 \( m8 x6 c11
! p* V% m, u1 g4 S3 M* F: v12$ j4 J3 U9 T( z. P6 o1 s
$databases['default']['default'] = array (6 O2 x$ I8 \2 l* S1 F1 h9 K
   'database' => 'db_site1',  b' \, b$ j4 P. T& F4 |
   'username' => 'db_multi_user',# T0 {) p3 {8 x8 i- |
   'password' => 'db_multi_password',( a' O1 A: e) b; s5 o* q, d& K
   'host' => 'localhost',9 g; G+ c8 }( ]( `$ s
   'port' => '',
/ l% L, ~* d7 @: c   'driver' => 'mysql',/ V5 R7 z' M2 M* m0 `% B+ K
   'prefix' => '',
! y# C4 r! L# G1 F  );
' ~* l# `% U$ E// Read more about this variables in settings.php$ X% I" U. J8 W
$base_url = 'http://site1.drupalla.com';( D! Q) A$ _. R
$cookie_domain = '.drupalla.com'; // 这段能让网站单点登录,前提是多站点都是同一个域下的二级域

 

 

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

1, g2 C5 Z/ ~! L( j4 Y6 S
2, }+ ]: R2 M! ?. k& K  q$ e! x
3! _3 _0 q/ _* o8 n0 R) R6 [" L4 x( }
4" P" |/ i0 Z! f3 g7 e5 r/ h
5, g2 t. r. \  j! h# l( r0 z
62 [1 y9 n5 n3 Q
7
) O  S. n) ?9 x8
# s) t8 X: t) b( {# N9
3 `$ e2 I- s+ Q& m8 C& N. E10) `7 V6 P3 q& e+ M' f! H
11
0 \$ r2 M7 ?7 |8 d. Y12
2 [5 n- ?0 ^8 D2 }2 H4 N, ?13% n6 V' ?6 U+ k' W- \9 W( q9 \  ]7 k
14% k3 g6 W7 n1 o: w& o  s$ i
15
( P& _0 P/ X# o% i16
1 p6 ^6 i% e% `" v% z) k17: @% s# x1 Y3 ]: O3 _+ _3 j
18+ p9 c. ]/ M7 L- a
19% P3 p1 q+ E( _, h8 {/ c1 E
$databases['default']['default'] = array (% R  `, e1 F  [8 Q# V
   'database' => 'db_site2',% h" E: W- {/ R  [
   'username' => 'db_multi_user',  _- @! M3 L: ]% K$ d
   'password' => 'db_multi_password',
$ p/ ^* W5 d7 E3 F   'host' => 'localhost',
8 S2 F9 e8 i& B6 y   'port' => '',# p9 y" r* O! n2 L  m
   'driver' => 'mysql',# q4 W! q3 {. S- G
   'prefix' => array(1 F0 T" l7 R' Y0 T
    'default'   => 'db_site2.',: B  E2 h" ?( [1 G$ l
    'users'     => 'db_site1.',
  [$ P3 N; U: O    'sessions'  => 'db_site1.',
% p& Q$ }! ?8 T: h2 c5 P    'role'      => 'db_site1.',. i- ~7 n1 q7 B  V& e
    'authmap'   => 'db_site1.',7 y3 Q+ q- S+ S( _" t0 B7 O2 Z
    'users_roles'   => 'db_site1.',
6 v7 D0 D, V+ O& a: x' q   ),4 C2 U+ Q+ c8 y; g& q- w
  );' A! q$ g, r6 [% x) n7 v
// Read more about this variables in settings.php- l* J+ R# m) [& v+ G7 {, ^3 [
$base_url = 'http://site2.drupalla.com';
% U  ~, I7 o! \3 e( K2 \/ 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, 5-12-2025 15:13 , Processed in 0.699044 second(s), 164 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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