Skip to content

Instantly share code, notes, and snippets.

@liujingyu
Created May 6, 2015 02:01
Show Gist options
  • Save liujingyu/4a70b4dc0e025734315b to your computer and use it in GitHub Desktop.
Save liujingyu/4a70b4dc0e025734315b to your computer and use it in GitHub Desktop.
wiki 搭建过程
Apache
yum -y install httpd #根据提示,输入Y安装即可成功安装
service httpd start #启动Apache
备注:Apache启动之后会提示错误:
正在启动 httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName
解决办法:
vi /etc/httpd/conf/httpd.conf #编辑
找到 #ServerName www.example.com:80
修改为 ServerName www.osyunwei.com:80 #这里设置为你自己的域名,如果没有域名,可以设置为localhost
ZZ #保存退出
chkconfig httpd on #设为开机启动
service httpd restart #重启Apache
Apache配置
vi /etc/httpd/conf/httpd.conf #编辑文件
ServerTokens OS  在44行 修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的名称)
KeepAlive Off 在76行 修改为:KeepAlive On (允许程序性联机)
MaxKeepAliveRequests 100 在83行 修改为:MaxKeepAliveRequests 1000 (增加同时连接数)
Options Indexes FollowSymLinks  在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
AllowOverride None  在338行 修改为:AllowOverride All (允许.htaccess)
DirectoryIndex index.html index.html.var 在402行 修改为:DirectoryIndex index.html index.htm Default.html Default.htm
ServerSignature On  在536行 修改为:ServerSignature Off (在错误页中不显示Apache的版本)
Options Indexes MultiViews FollowSymLinks 在554行 修改为 Options MultiViews FollowSymLinks(不在浏览器上显示树状目录结构)
#AddHandler cgi-script .cgi 在796行 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
#末尾加上以下三行,开启gzip文件压缩
<Location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css
</Location>
ZZ #保存退出
service httpd restart #重启
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页
Mysql
高版本mysql安装
添加5.6或5.7 /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
验证 yum repolist enabled | grep mysql
1、安装MySQL
yum -y install mysql mysql-server
service mysqld start #启动MySQL
chkconfig mysqld on #设为开机启动
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
2、为root账户设置密码
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!
MySql密码设置完成,重新启动 MySQL:
service mysqld restart #重启
php
1、安装PHP5
yum -y install php
2、安装PHP组件,使 PHP5 支持 MySQL
yum -y install php-devel php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
service mysqld restart #重启MySql
service httpd restart #重启Apche
安装phpMyAdmin的简单步骤
x86_64 系统安装命令:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
i386 系统安装命令:
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
现在可以安装phpMyAdmin如下:
yum -y install phpmyadmin
现在,我们配置phpMyAdmin。改变Apache的配置,使phpMyAdmin连接,而不仅仅是从localhost(注释掉允许) :
vi /etc/httpd/conf.d/phpmyadmin.conf
# Web application to manage MySQL
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
下一步,我们改变在phpMyAdmin的身份验证cookie ,HTTP:
vi /usr/share/phpmyadmin/config.inc.php
重新启动Apache:
service httpd restart
之后,您可以根据访问phpMyAdmin http://192.168.10.100/phpmyadmin/管理数据库了。
Memcache服务器与php扩展
yum install memcached php-pecl-memcache
1、安装成功后,检测php是否正常加载了memcache模块:
[root@www ~]# php -m|grep memcache
memcache
返回了“memcache”表示已经安装。
2、设置memcached服务开机自动启动
[root@www ~]# chkconfig --level 2345 memcached on
3、启动memcached服务并重启Apache
[root@www ~]# service memcached start
启动 memcached:[确定]
[root@www ~]# service httpd restart
停止 httpd:[确定]
启动 httpd:[确定]
4、测试php支持memcache是否正常
在apache的网站根目录建立 memcache.php 文件
<?php
$memcache = new Memcache();
$memcache->connect('127.0.0.1', 11211);
$memcache->set('key', 'Memcache test successful!', 0, 60);
$result = $memcache->get('key');
unset($memcache);
echo $result;
如果一切正常,访问此页面,应该正常返回“Memcache test successful”,至此,Memcached与php扩展memcache安装成功。
5、Memcached的默认端口为11211,因此在php中使用此端口即可。下面顺便给出个清除memcache所有缓存内容的方法: 执行:
[root@www ~]# nc localhost 11211
然后输入:
flush_all
quit
即可。
intl安装
sudo yum install libicu
sudo yum install libicu-devel.x86_64
sudo /usr/bin/pecl install intl
sudo echo 'extension=intl.so' >> /etc/php.ini
wiki扩展
编辑器
第一步:
cd extensions && git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/WikiEditor.git && cd ..
第二步:
在 LocalSettings.php文件的最底下添加一行:
require_once "$IP/extensions/WikiEditor/WikiEditor.php";
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
$wgDefaultUserOptions['wikieditor-preview'] = 1;
$wgDefaultUserOptions['wikieditor-publish'] = 1;
MediaWiki如何重置用户密码
您可以使用maintenance/changePassword.php维护脚本来重置一名用户的密码。
进入安装目录,然后进入maintenance子目录。运行下列命令:
php changePassword.php --user=someuser --password=somepass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment