[2009-01-12] Drupal localhost 多站開發, Drupal localhost multi-site config

作為一個 Drupal developer, 通常都有幾個開發同時進行
一般人可能會用htdocs/[folder] 名
例如 http://localhost/drupal6, http://localhost/drupal5
或者案子名 http://localhost/blog 等等
但萬一core 要更新, 或者cck, views 有更新
便要更數個站, 實在麻煩

大家都或者知道 Drupal 是可以設定 multi-site 的
即是, 同一套code 可以供給兩個站使用 ( 例如 example1.com 和 example2.com )
優點很簡單, 模組更新的時候, 只要更新一次便可以令兩個完全不相關的 Drupal 站更新模組
而兩站可以使用完全不同的模版, 完全不同的資料庫
只是共用 core 和某些常用的模組 (例如views, cck 之類)

你的 drupal-root 內的 sites 資料夾,
可以建立 all, example1.com, example2.com 等等的資料夾
all 內的 modules, themes 是供放多站共用的資料
而 example1.com 內也可以建立 modules, themes 資料夾, 放這個域名專用的模組

所以現在只要將某個domain 指到 localhost
便可以實現 http://blog.localhost/drupal6, http://shop.localhost/drupal6.........

到 C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 blog.localhost
127.0.0.1 shop.localhost
...
..

再在 htdocs/drupal6/sites/blog.localhost/ 內建一個 settings.php 便可以了
便可以 http://blog.localhost/drupal6/install.php

相關資源
http://drupal.org/getting-started/6/install/multi-site

Comments

版主您好:

版主您好:
看了你的教程還有你所提供的方向網站…覺得還是不理解
http://drupal.org/getting-started/6/install/multi-site
(1)建立一個新的資料庫
(2)於sites創立一個新的子目錄。(叫test.localhost)-->因為只是內部測試無子網域
(3)將sites中的default中的settings.php (copy到新的站點-->就上面第2步驟的地方)

>w<謝謝

版大您好:

版大您好:
在到 C:\WINDOWS\system32\drivers\etc\hosts中找不到hosts >w<…謝謝

版大您好:

版大您好:
(1)我建了一個新的目錄到sites/med.localhost (因為我沒有網域名~所以我用本機-->是這樣嘛?
(2)之後copy一個settings.php 到sites/med.localhost 目錄底下~
(3)修改settings.php中的
$db_url = 'mysqli://small:apple@localhost/med';(指到另一資料庫)
$db_prefix = '';
(4)但~~~之後要怎建一個新的站進來呢?
>w<…help~~~謝謝~~~

版大您好:

版大您好:
但有找到相關教學~~但還是不理解>w<
http://bbs.zzbaike.com/thread-3948-1-1.html
修改 Apache 使其能对新站点做出回应 步骤:在httpd.conf 末尾添加:

DocumentRoot c:/test/drupal(说明:第二个站点根目录位置)
ServerName drupalsite (说明:第二个站点名称)

若我的目錄結構是C:\website\htdocs\website\sites (主站)
那新建的另一個站點的指向路徑要怎加呢?
我的新站目錄結構C:\website\htdocs\website\sites\med.localhost

謝謝

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h4> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options