安装、升级dokuwiki api wiki

安装dokuwiki

nginx配置

server {
    listen  12581;
    server_name localhost;
    root     /mnt/www/dokuwiki;
    index   doku.php;

    location / {
        if (!-e $request_filename) { 
            rewrite ^/(.*) /index.php last;
        }
    }
    location ~ \.(js|css|png|jpg|jpeg|gif)$ {
        if (!-e $request_filename) {
            break;
        }
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

安装配置doku

tar -zxvf dokuwiki-8a269cc015a64b40e4c918699f1e1142.tgz
chown www:www dokuwiki/ -R
http://47.104.18.17:12581/install.php?l=zh
mv install.php install.php.bak

修改数据和配置目录

mkdir dokuwiki-data
cp -R conf /mnt/www/dokuwiki-data
cp -R data /mnt/www/dokuwiki-data
chown www:www dokuwiki-data/ -R

cd dokuwiki/inc
cp preload.php.dist preload.php
vim preload.php
define('DOKU_CONF','/mnt/www/dokuwiki-data/conf/');

修改nginx配置

location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }

    location / { try_files $uri $uri/ @dokuwiki; }

    location @dokuwiki {
        # rewrites "doku.php/" out of the URLs if you set the userewrite setting to .htaccess in dokuwiki config page
        rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
        rewrite ^/_detail/(.*) /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 ~ \.php$ {
        try_files $uri $uri/ /doku.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param REDIRECT_STATUS 200;
        fastcgi_pass   127.0.0.1:9000;
    }

升级dokuwiki

由于我采用的是,程序和数据分离的方式,所以升级会省心不少 各位小伙伴,升级之前,一定要备份数据啊

dokuwiki总是让升级

1.下载最新版dokuwiki

2.停止wiki的nginx解析

防止有人在升级过程中访问

3.设置preload.php数据解析目录

将preload.php.dist复制一份改名为preload.php,并增加以下代码 目录inc下

# 其中xxxxx是你的数据目录
define('DOKU_CONF','/mnt/www/xxxxx/conf/');

4.拷贝主题

将之前项目lib/tpl/bootstrap3,拷贝到新的dokuwiki项目中

5.恢复nginx

设置doki wiki

设置上传文件大小和类型类型限制

问题

使用Site Export插件报错Preload File locked. It exists and is readable, but it can't be written.

这表明你的preload.php文件没有可写权限

file

➜  inc ll preload.php
-rwxr-xr-x 1 root root 684 5月  20 11:41 preload.php
chown www:www preload.php

点击这里查看解决方案

参考文章

🤓 🤓 🤓 🤓