[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

Google