さくらインターネットにDokuWikiをインストールする
今まで、さくらインターネットでSiteDev2を動かしていた。しかしPHPがセーフモードでしか動作しないさくらインターネットでSiteDev2動かすためには、それなりに修正が必要だったし、その修正が原因でプラグインが正常に動作しなかったり困っていた。
そこで他にセーフモードでも特に問題なく動作するWikiエンジンはないかなと探していたら、DokuWikiの評判が良いようなので早速インストールしてみることにした。
2. PHP
PHP のバージョンは 4.3.3 以上であれば動作しますがセキュリティ上の理由から 4.3.10 以上を利用するべきです。 PHP 5 でも問題なく動作します。
画像のリサイズ機能を利用するためには PHP LibGD 拡張 もしくは Image Magick がインストールされている必要があります。
DokuWiki は PHP のセーフモード環境下でも動作するはずですが、 ホスト側の設定によっては safemodehack オプションの利用が必要となる場合があります。
http://www.dokuwiki.org/%3Aja%3Arequirements
DokuWikiのインストール
以下、~/www/dokuwiki/以下にインストールする例。
% mkdir src % cd src % wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-02-14b.tgz % tar zxf dokuwiki-2009-02-14b.tgz % mv dokuwiki-2009-02-14 dokuwiki % mv dokuwiki ~/www/ % touch ~/www/dokuwiki/data/changes.log
wgetするファイルはもちろんダウンロードページから最新版にすべし。
ここまで来たら http://(サーバーのアドレス)/dokuwiki/install.phpにアクセスして管理ユーザーの設定などをする。
右上にある言語設定をjaにしておくと日本語で設定できる。
終わったら ~/www/dokuwiki/install.phpを削除する。
この時点でもうWikiとして使えるようになっているはず。
arcticテンプレートのインストール
DokuWiki標準のテンプレートではサイドバーがない。(これくらいは標準で入ってて欲しいところ)
そこで、サイドバー対応のテンプレート「arctic」をインストールする。*1
インストール方法は簡単。ファイルをダウンロードして(DokuWikiのインストールパス)/lib/tp/に配置するだけ。
% cd src % wget "http://www.dokuwiki.org/lib/exe/fetch.php?media=http%3A%2F%2Fcloud.github.com%2Fdownloads%2Fchimeric%2Fdokuwiki-template-arctic%2Ftemplate-arctic-2009-03-25.tgz" % tar zxf template-arctic-2009-03-25.tgz % mv arctic ~/www/dokuwiki/lib/tpl/
wgetするアドレスはもちろんここを確認して、最新の安定版にしておいた方がよい。
(上記の例では2009-03-25版)
あとはDokuWikiにログインして管理>サイト設定の「テンプレート」を「arctic」にすればOK
記事のアドレスをPukiwikiのようにスラッシュ区切りにする
サイト設定の「高度な設定」で以下のように設定する。
このままの状態だと、記事や管理画面にアクセスできなくなる*2ので、.htaccessの設定をする。
%cd ~/www/dokuwiki/ %vi .htaccess.dist %mv .htaccess.dist .htaccess
.htaccessの内容はこんな感じ。基本的には「Rewrite〜」となっている行のコメントアウトを削除すればよい。
## Enable this to restrict editing to logged in users only ## You should disable Indexes and MultiViews either here or in the ## global config. Symlinks maybe needed for URL rewriting. #Options -Indexes -MultiViews +FollowSymLinks ## make sure nobody gets the htaccess files <Files ~ "^[\._]ht"> Order allow,deny Deny from all Satisfy All </Files> ## Uncomment these rules if you want to have nice URLs using ## $conf['userewrite'] = 1 - not needed for rewrite mode 2 RewriteEngine on ## Not all installations will require the following line. If you do, ## change "/dokuwiki" to the path to your dokuwiki directory relative ## to your document root. RewriteBase /dokuwiki ## If you enable DokuWikis XML-RPC interface, you should consider to ## restrict access to it over HTTPS only! Uncomment the following two ## rules if your server setup allows HTTPS. RewriteCond %{HTTPS} !=on RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L] RewriteRule ^index.php$ doku.php
RewriteBaseはDokuWikiをインストールしたパスによって適宜修正すること。
今回は~/www/dokuwiki/にインストールしたのでそのままでOKだった。