dokuwiki 应用实践

1、安装dokuwiki

[root@LeeKwen ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

[root@LeeKwen ~]# uname -ra
Linux LeeKwen 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 23 03:35:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

2、配置dokuwiki

## 环境配置 ##
[root@LeeKwen ~]# yum install httpd
[root@LeeKwen ~]# yum install php
[root@LeeKwen ~]# chkconfig httpd on

## 下载源码 ##
[root@LeeKwen ~]# wget -c https://download.dokuwiki.org/out/dokuwiki-c5525093cf2c4f47e2e5d2439fe13964.tgz
[root@LeeKwen ~]# mv dokuwiki-c5525093cf2c4f47e2e5d2439fe13964.tgz  /var/www/html/dokuwiki.tgz
[root@LeeKwen ~]# cd /var/www/html/
[root@LeeKwen html]# tar zxvf dokuwiki.tgz
[root@LeeKwen html]# chown -R apache.apache ./dokuwiki*

### 修改httpd配置文件 ###
[root@LeeKwen html]# vim /etc/httpd/conf/httpd.conf

       ##  修改前  ##					        ####  修改后  ###

 DocumentRoot "/var/www/html"  --->   DocumentRoot "/var/www/html/dokuwiki"
 
 <Directory "/var/www/html">   --->   <Directory "/var/www/html/dokuwiki">
 
 
[root@LeeKwen html]# /etc/init.d/httpd restart

打开http://IP地址/install页面进行安装、配置即可。

### 安全配置 ###

[root@LeeKwen html]# vim /etc/httpd/conf/httpd.conf

增加如下行:
<LocationMatch "/(data|conf|bin|inc)/">
        order allow,deny
        deny from all
        satisfy all
</LocationMatch>


###摘录httpd.conf的配置信息###
Include conf.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
UseCanonicalName Off
DocumentRoot "/var/www/html/dokuwiki"
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory "/var/www/html/dokuwiki">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<LocationMatch "/(data|conf|bin|inc)/">
        order allow,deny
        deny from all
        satisfy all
</LocationMatch>
<IfModule mod_userdir.c>
    UserDir disabled
</IfModule>
DirectoryIndex index.html index.html.var
AccessFileName .htaccess
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
TypesConfig /etc/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error_log
LogLevel warn

3、解决Linux系统文件夹的中文乱码

### data/pages中的中文文件夹乱码问题 ###
[root@LeeKwen pages]# pwd
/var/www/html/dokuwiki/data/pages

修改文件:
1、/var/www/html/dokuwiki/conf/local.php

摘录local.php的对应内容:

$conf['superuser'] = '@admin';
//add start
$conf['fnencode'] = 'utf-8';
//add end



2、/var/www/dokuwiki/inc/pageutils.php

摘录pageutils.php的对应内容:

函数一:

function utf8_encodeFN($file,$safe=true){
    global $conf;
    if($conf['fnencode'] == 'utf-8') return $file;

    if($safe && preg_match('#^[a-zA-Z0-9/_\-\.%]+$#',$file)){
        return $file;
    }

    if($conf['fnencode'] == 'safe'){
        return SafeFN::encode($file);
    }

    #add start
    if($conf['fnencode'] == 'gbk'){
        return mb_convert_encoding($file,'gbk','UTF-8');
    }
    # add end

    $file = urlencode($file);
    $file = str_replace('%2F','/',$file);
    return $file;
}


函数二:

function utf8_decodeFN($file){
    global $conf;
    if($conf['fnencode'] == 'utf-8') return $file;

    if($conf['fnencode'] == 'safe'){
        return SafeFN::decode($file);
    }

    #add start
    if($conf['fnencode'] == 'gbk'){
        return mb_convert_encoding($file,'utf-8','gbk');
    }
    # add end

    return urldecode($file);
}

[root@LeeKwen ~]# /etc/init.d/httpd restart

4、插件相关配置

此插件的在线安装相对简单,只需要以管理员身份登录dokuwiki,在”管理“-->”扩展管理器“-->”搜索和安装“-->”搜索扩展“框中输入对应的插件名,点击”安装“即可。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Leekwen

您的鼓励,是我坚持更新的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值