CentOS 7通过RPM包部署LAMP+xcache (php module)
环境要求:
(1)一个虚拟主机提供phpMyadmin
(2)一个虚拟主机提供WordPress
(3)利用xcache缓存来进行页面加速
(4)进行页面压力测试
wp.linuxidc.com------>提供WordPress
pma.linuxidc.com---->提供phpMyAdmin
1、安装httpd、php、php-myql、mariadb-server
[root@linuxidc ~]# yum -y install httpd php php-MySQL mariadb-server
[root@linuxidc ~]# rpm -q php
php-5.4.16-36.1.el7_2.1.x86_64
[root@linuxidc ~]#
[root@linuxidc ~]# rpm -q httpd
httpd-2.4.6-40.el7.centos.1.x86_64
[root@linuxidc ~]#
[root@linuxidc ~]# rpm -q php-mysql
php-mysql-5.4.16-36.1.el7_2.1.x86_64
[root@linuxidc ~]#
[root@linuxidc ~]# rpm -q mariadb-server
mariadb-server-5.5.47-1.el7_2.x86_64
[root@linuxidc ~]#
[root@linuxidc ~]# rpm -q mariadb
mariadb-5.5.47-1.el7_2.x86_64
2、启动所有的服务查看是否正常
启动httpd服务的时候最好是添加下以下一条,否则要解析,启动老慢了
[root@linuxidc ~]# vim /etc/httpd/conf/httpd.conf
ServerName localhost:80
[root@linuxidc ~]# systemctl start httpd.service
[root@linuxidc ~]# systemctl start mariadb.service
[root@linuxidc ~]# ss -tnl ####查看下监听地址是否正常
State Recv-Q Send-Q Local Address:Port
LISTEN 0 50 *:3306 ##监听的mysql端口
LISTEN 0 5 192.168.122.1:53
LISTEN 0 128 *:22
LISTEN 0 128 :::80 ##监听的httpd服务端口
3、配置虚拟主机,提供两个虚拟主机为WordPress何phpmyadmin做准备
[root@linuxidc ~]# vim /etc/httpd/conf.d/vhost1.conf ###第一个虚拟主机
<VirtualHost 192.168.1.104:80>
DocumentRoot /data/www1/vhost1
ServerName wp.linuxidc.com
ErrorLog "/var/log/www1/vhost1/error_log" ##错误日志
CustomLog "/var/log/www1/vhost1/access_log" common ###访问日志
<Directory "/data/www1/vhost1">
Options None
AllowOverride None
Require all granted ##此处需要授权,否则无法访网页
</Directory>
</VirtualHost>
[root@linuxidc ~]# vim /etc/httpd/conf.d/vhost2.conf ###第二个虚拟主机
<VirtualHost 192.168.1.104:80>
DocumentRoot /data/www2/vhost2
ServerName pma.linuxidc.com
ErrorLog "/var/log/www2/vhost2/error_log"
CustomLog "/var/log/www2/vhost2/access_log" common
<Directory "/data/www2/vhost2">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
4、准备网页及日志路径等信息
[root@linuxidc ~]# mkdir -p /data/www1/vhost1 #####DocumentRoot路径
[root@linuxidc ~]# mkdir -p /data/www2/vhost2
[root@linuxidc ~]# echo "vhost1" > /data/www1/vhost1/index.html ###网页路径
[root@linuxidc ~]# echo "vhost2" > /data/www2/vhost2/index.html
[root@linuxidc ~]# mkdir -p /var/log/www1/vhost1 ###日志路径
[root@linuxidc ~]# mkdir -p /var/log/www2/vhost2