1、安装依赖软件
yun install gcc-c++
yun install make
yun install expat-devel
yun install perl
yun install curl-devel
yun install libxml2-devel
yun install libjpeg-devel
yun install libpng-devel
yun install freetype-devel
2、安装httpd
#yum list httpd //查找可安装httpd程序包
#yum install ***.(如httpd.x86_64)//安装相应httpd程序包
3、安装php
#yum list php //查找可安装php程序包
#yum install ***.(如php.x86_64) //安装相应php程序包
4、安装dokuwiki(建议下载下面的稳定安装包,下载最新包可能会报错)
#wget -c http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz //下载网站安装压缩包
#tar -zvxf dokuwiki-stable.tgz //解包解压缩
#cp -r dokuwiki-2013-05-10a/* /var/www/html/wiki //复制解压的网站源码文件到网站根目录
5、更改 httpd.conf
# vi /etc/httpd/conf/httpd.conf
将 DocumentRoot 目录更改到第4步中的dokuwiki路径下 默认为/var/www/html
下面配置作用是对URL进行过滤以保证数据安全
<LocationMatch "/wiki/(data|conf|bin|inc)/">
Order allow,deny
Deny from all
Satisfy all
</LocationMatch>
6、修改权限
根据httpd.conf 中下述两个配置值进行修改
User apache
Group apache
权限不修改会导致下面的访问页面报错
#chown -R apache.apache /var/www/html/wiki/将文件所有者由root用户改为apache用户
以下引入dokuwiki官方说明:
权限说明
dokuwiki以文件的形式存储配置文件和页面数据,为了wiki的安全,需要确保以下目录不能通过web被公众用户访问。
data
conf
bin
inc (isn't dangerous when accessible, though)
可以通过_cat /ect/group_和_cat /etc/passwd_命令分别查看组信息和用户信息。
cat /etc/group结果参数说明
组名:口令:组标识号:组内用户列表
root:x:0:
apache:x:48:
php-fpm:x:991:
cat /etc/passwd结果参数说明
用户名:口令:用户标识号:组标识号:注释性描述:主目录:登录Shell
root:x:0:0:root:/root:/bin/bash
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
php-fpm:x:995:991:php-fpm:/var/lib/php/fpm:/sbin/nologin
权限配置及wiki安装
由于本人是在root账户下执行,因此
1)首先将dokuwiki的目录所有者改为Web Server所在的用户和用户组(用户名为apache,组ID为48)
[root@izwz934uda0vhwlzenknpcz html]# chown -R apache:48 dokuwiki安装目录7、调整Apache mime设定,让Apache 可以支援 PHP (/etc/mime.types ) ,在配置中加入
application/x-httpd-php php php4 phtml
application/x-httpd-php-source : phps
8、 重启 Apache ( systemctl restart httpd.service ),连接到 Wiki 下的目录执行 install.php 进行安装设定(http://IP或者域名/wiki/install.php?l=zh)如出现以下红框内提示或者访问http://IP或者域名/wiki/data/pages/wiki/dokuwiki.txt能访问到dokuwiki.txt文件,说明数据不安全,需返回步骤5进行URL过滤配置。
9、重启后访问http://IP/wiki/install.php时,可能会报以下错误:
The datadir ('pages') at ./data/pages is not found, isn't accessible or writable.解决办法:
(1)查看文件夹权限,将权限赋予apache用户
(2)查看apache的错误日志:
如报以下错误:
AH00170: caught SIGWINCH, shutting down gracefully
则关闭SELINUX
查看selinux状态
[root@localhost ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
[root@localhost ~]# setenforce 0 //临时关闭
永久关闭,可以修改配置文件/etc/selinux/config,将其中SELINUX设置为disabled。
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
重启后查看
[root@rdo ~]# sestatus
SELinux status: disabled