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,在”管理“-->”扩展管理器“-->”搜索和安装“-->”搜索扩展“框中输入对应的插件名,点击”安装“即可。