CentOS 7.4 yum方式安装LAMP环境,并部署WordPress,使用XCache优化性能

一、安装LAMP环境:

# yum -y install httpd mariadb-server PHP-MysqL PHP

程序包版本:

httpd:2.4.6

mariadb-server:5.5.56

PHP-MysqLPHP连接MysqL时需要用到的驱动):5.4.16

PHP:5.4.16

备注:

CentOS 7.4已经不再提供MysqL-server的程序包

httpd配置文件

1、主配置文件:/etc/httpd/conf/httpd.conf

2、辅助配置文件:/etc/httpd/conf.d/*.conf

3、模块配置文件:/etc/httpd/conf.modules.d/*.conf

mariadb配置文件:/etc/my.cnf

PHP配置文件/etc/PHP.ini

httpdPHP组合时需要用到的配置文件/etc/httpd/conf.d/PHP.conf

PHP组合时需要用到的模块文件/usr/lib64/httpd/modules/libPHP5.so

1e19f8b77e28e111c0c92c973838616f.jpg


二、测试# systemctl start httpd.service

# systemctl start mariadb.service

# MysqL_secure_installation

# MysqL -uroot -p

cf0185d0fe808b8bd68f588b467fd4e7.jpg


# vim /var/www/html/index.PHP

7590d263045e44474c9c7dea0429f789.jpg


浏览器中输入192.168.1.146

43b47b5d571e5ef2424f6c71bd6b9f15.jpg


三、安装配置wordpress

wordpress是一种使用PHP语言和MariaDB数据库开发的开源、免费的Blog引擎,用户可以在支持PHPMariaDB数据库的服务器上建立自己的Blogwordpress一个功能非常强大的博客系统插件众多,易于扩展,安装和使用都非常方便。目前wordpress已经成为主流的Blog搭建平台。下载地址https://cn.wordpress.org/,此处以wordpress-4.8.1-zh_CN.zip为例。

# yum -y install unzip

# unzip -q wordpress-4.8.1-zh_CN.zip

# cp -a wordpress/ /var/www/html/

# cd /var/www/html/wordpress

# cp wp-config-sample.PHP wp-config.php

# vim wp-config.php修改数据库相关信息:

32ba205bb85de533be8aca7cdd3e073d.jpg


# MysqL -uroot -p

MariaDB [(none)]> create database wordpressdb;

MariaDB [(none)]> grant all on wordpressdb.* to 'wpuser'@'%'identified by "123456";

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit

# MysqL -uwpuser -p

MariaDB [(none)]> show databases;

dfb53c6041eb8dd5aa4b523a9cef9942.jpg


浏览器中输入192.168.1.146/wordpress

3acb234905abfdec052e5b4c88ff91f8.jpg


点击“安装wordpress”:

733431dcc35941e8417903e7a0e5d5f8.jpg


点击“登录”:

6e2ff4c8d1cbf183cbc3a96ae987e5a0.jpg


输入用户名和密码,点击“登录”:

e437b47b21bf7cdc05d442890c6dc073.jpg


42ebf2b6fc4df93bfe061bd98b8d4239.jpg


274fe808ae826e41c924c0981b4ceae9.jpg

删除安装文件# rm -rf /var/www/html/wordpress/wp-admin/install.PHP


四、使用XCache优化性能

未加载XCache模块时测试性能# ab -c 20 -n 1000 http://192.168.1.146/wordpress/index.PHP

配置epel源:# yum -y install PHP-xcache

# rpm -ql PHP-xcache--> /etc/PHP.d/xcache.ini/usr/lib64/PHP/modules/xcache.so

# systemctl reload httpd.service

刷新页面,已加载XCache相关模块:

a5975e4271eecf8012cce1b299cd1352.jpg

加载# ab -c 20 -n 1000 http://192.168.1.146/wordpress/index.php

性能显著提升

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native