ユーザ用ツール

文書の過去の版を表示しています。


DocWikiに関して

概要

導入

設定

Nginx+php-fpm

PHPベースのシステムなので、例によって Nginx+php-fpmで運用する。 SSLにはLet's encryptを使用する。

upstream wiki-handler {
    server unix:/var/run/php-fpm.sock;
}
server {
    listen 80;
    server_name wiki.example.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name wiki.example.com;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    root /var/www/dokuwiki;
    access_log /var/log/nginx/wiki_access.log;
    error_log /var/log/nginx/wiki_error.log;
    index index.php index.html doku.php;
    location / {
        try_files $uri $uri/ @dokuwiki;
    }
    location ~ \.php$ {
        try_files $uri $uri/ /doku.php;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_keep_conn on;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass wiki-handler;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $uri;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
    }
    location @dokuwiki {
        rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
        rewrite ^/_datail/(.*) /lib/exe/detail.php?media=$1 last;
        rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
        rewrite ^/(.*) /doku.php?id=$1&$args last;
    }
    location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
        expires 30d;
    }
    location ~ \.ht {
        deny all;
    }
    location ~ /(data|conf|bin|inc|vendor)/ {
        deny all;
    }
}

PHP(php-fpm)の設定

DocWikiはUTF-8を前提としている。 特に、編集のためのテキストエリアへのコンテンツの呼出には、htmlspecialchars()を利用しており、PHPのデフォルトの文字セットがUTF-8になっていないと、編集が出来なくなってしまう。1)

php-fpmが利用したい文字コードとデフォルトのPHPの文字コードが異なる場合、php-fpmの設定で、この部分を上書きするようにすれば良い。 例えば、VineLinuxのように php.inidefault-charset=“EUC_JP”となっている場合には、/etc/php5/fpm.d/default-pool.conf の下の方に次の一行を追加してやり、php-fpmを再起動すればよい。

php_admin_value[default_charset] = UTF-8

Pukiwikiからの移行

自分Wikiに書きためた内容は、知的資産2)であり、システムを移行したら引き継がれるべきものであろう。

PukiwikiとDokuwikiとではマークアップの仕方が違うため、単純にファイルを移行したり内容をコピペしたりしても、内容を引き継げるわけではない。

しかし、既に先人がおり、移行用のスクリプトを提供してくれているので、それを利用するのがいいだろう。

移行準備

以下のプラグインを導入する必要がある。

  • definitions plugin
  • indexmenu plugin
  • color plugin

それぞれ、Dokuwikiの管理メニューから導入しておく。

移行の実際

移行は、添付ファイル3)、本文の二段階で行う。 まずは画像。

$ puki2doku.pl -v -A -E utf8 -s /var/www/pukiwiki/picture -d /var/www/dokuwiki/data/media

なお、-E utf8はPukiwikiをUTF-8化していた場合のみ必要。

次に本文を移行する。

$ puki2doku.pl -v -E utf8 --font-color --indexmenu --ignore-unknown-macro -s /var/www/pukiwiki/wiki -d /var/dokuwiki/data/pages

同様に、-E utf8はUTF-8化していた場合にのみ用いる。

1)
編集画面内のtextareahtmlspeialchars()によって空欄になってしまう。
2)
または二度と見たくはない黒歴史?
3)
主に画像?

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information