安装wiki
安装环境:
libxml2-2.6.26
linux Centos6.2 + nginx/1.10.1 + mysql 5.1.73 + PHP 5.3.3
1. 安装libxml2
通过yum安装:
yum -y install libxml2
或者通过手动编译安装:
wget http://xmlsoft.org/sources/old/libxml2-2.6.26.tar.gz
tar xvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure --prefix=/usr/local/libxml2/
make
make install
如果安装失败:make uninstall
2. 安装mysql、php
yum install mysql-server mysql
service mysqld start
设置mysql的root密码
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
yum -y install php
yum install php-mysql (不安装提示:找不到合适的数据库驱动!)
将php-cgi绑定到9000端口
nohup php-cgi -b 127.0.0.1:9000 &
3. 获取mediawiki
wget https://releases.wikimedia.org/mediawiki/1.17/mediawiki-1.17.5.tar.gz
tar -xvf mediawiki-1.27.0.tar.gz
mv mediawiki-1.27.0 mediawiki
将mediawiki文件夹放置到指定记录mediawiki文件夹所在位置,用于配置nginx
4. 配置nginx
server {
listen 8089;
server_name 172.24.190.13;
access_log /var/log/nginx/wiki-access.log;
error_log /var/log/nginx/wiki-error.log;
charset utf-8;
root /var/www/wiki;
#让http请求重定向到https请求
error_page 497 https://$server_name$request_uri;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location /{
root /var/www/wiki;
index index.php index.html index.htm;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/wiki$fastcgi_script_name;
include fastcgi_params;
}
location /resource/ {
root /data/www/wiki;
}
}
5. 用浏览器访问mediawiki中的index.php开始设置wiki