2010年11月10日

Wordpress MU 的設定

程式名稱:WordPress MU
官方網站:http://mu.wordpress.org/
程式下載:按這裡
備註事項:從WordPress3.0起整合於WordPress,所以直接下載WordPress。
假設你己裝好 Apache, PHP5, mySQL
  註: 要開始設定 WP, 首先要連上的網址是:
       http://xx.xx.xx.xx/wp-admin/
       才會啟動以上的設定程序

1. 要先安裝 WP 的單人版 (可參見: 如何架設安裝WordPress部落格?)
2. 裝好後, 修改 WP 目錄中的 wp-config.php, 在以下
    /* That’s all, stop editing! Happy blogging. */
    的上方加入一行:
define('WP_ALLOW_MULTISITE', true);
請另在「/var/www/wp-content」目錄下新建一個資料夾「blogs.dir」並設定資料夾屬性為「777」,讓用戶可上傳檔案。

3. 重新整理部落格後台,點擊左方【工具】 (Tools)→「網誌網路」(Network),進入後請將網誌網路的標題和聯絡信箱設定好,並點擊﹝安裝﹞(Install)。
  重新安裝一次 WP 時, 要刪除原在在 mySQL 中已建好的 schema (資料庫), 再重新建 schema)

4.  在剛剛改過的 wp-config.php 中相同的位置, 加入以下:
即在這一行 define('WP_ALLOW_MULTISITE', true); 的下方, 加入
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false ); $base = '/';
define( 'DOMAIN_CURRENT_SITE', 'xxx.xxx.xxx' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
 5. 在 wp-config.php 相同的子目錄下,新增一個 .htaccess 檔, 再貼上
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
6. 這樣應該就可以啟動 Wordpress MU 了, 如果子網站無法連結, 應該是 Apache 的 rewrite 功能未開啟

7. 開啟 Apache 的 rewrite 功能
先啟動 rewrite 模組, 在終端機中下指令:
sudo a2enmod rewrite
(在 ubuntu 中, Apache 的預設安裝路徑是 /etc/apache)
然後修改 /etc/apache2/sites-available 中的 default 檔, 將其中的 AllowOverride NONE, 改成 AllowOverride All, 如下

         
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

     
   

8. 重新啟動 apache, 在終端機中下指令

sudo /etc/init.d/apache2 restart
這樣應該就完成了!


==如果無法內建安裝外掛、佈景==
(試過 wp 4.2 on Mint 7)
在 wp-config.php 中的最後,加上幾行如下,即可啟動內建安裝:


if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}


另見: Wordpress 的上傳檔案大小限制



參見:


=== see also ===
Re: Where is Apache installed on Ubuntu?
Apache config files are in /etc/apache
Apache log files are in /var/log/apache
Apache libs are in /usr/lib/apache
Other files can be in /usr/share/apache, /var/lib/apache