Q1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块
环境:2台主机 server-A 192.168.37.7 server-B 192.168.37.17
#server-A
[root@Centos7 ~]# yum install httpd php php-mysql php-devel php-mbstring -y
[root@Centos7 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
[root@Centos7 ~]# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
[root@Centos7 ~]# tar xf xcache-3.2.0.tar.gz -C /usr/local/src
[root@Centos7 ~]# cd /usr/local/src/xcache-3.2.0/
[root@Centos7 xcache-3.2.0]# phpize --clean && phpize
[root@Centos7 xcache-3.2.0]# ./configure --enable-xcache
[root@Centos7 xcache-3.2.0]# make && make install
[root@Centos7 xcache-3.2.0]# cp xcache.ini /etc/php.d/
[root@Centos7 xcache-3.2.0]# systemctl start httpd
[root@Centos7 xcache-3.2.0]# vim /var/www/html/info.php
<?php
phpinfo();
?>
#server-B
[root@Centos7 ~]# yum install mariadb-server -y
[root@Centos7 ~]# systemctl start mariadb
验证:http://192.168.37.7/info.php

Q2、部署wordpress论坛,并实现正常访问登录论坛。
#server-A
[root@Centos7 ~]# yum install httpd php php-mysql php-devel php-mbstring -y
[root@Centos7 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
[root@Centos7 ~]# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
[root@Centos7 ~]# tar xf xcache-3.2.0.tar.gz -C /usr/local/src
[root@Centos7 ~]# cd /usr/local/src/xcache-3.2.0/
[root@Centos7 xcache-3.2.0]# phpize --clean && phpize
[root@Centos7 xcache-3.2.0]# ./configure --enable-xcache
[root@Centos7 xcache-3.2.0]# make && make install
[root@Centos7 xcache-3.2.0]# cp xcache.ini /etc/php.d/
[root@Centos7 xcache-3.2.0]# systemctl start httpd
[root@Centos7 ~]# tar xf wordpress-5.1.4-zh_CN.tar.gz -C /var/www/html
[root@Centos7 ~]# cd /var/www/html
[root@Centos7 html]# chown apache:apache wordpress/
[root@Centos7 html]# cd wordpress/
[root@Centos7 wordpress]# cp wp-config-sample.php wp-config.php
[root@Centos7 wordpress]# vim wp-config.php
/** WordPress数据库的名称 */
define( 'DB_NAME', 'wordpress' );
/** MySQL数据库用户名 */
define( 'DB_USER', 'wpuser' );
/** MySQL数据库密码 */
define( 'DB_PASSWORD', 'centos' );
/** MySQL主机 */
define( 'DB_HOST', '192.168.37.17' );
#server-B
[root@Centos7 ~]# yum install mariadb-server -y
[root@Centos7 ~]# systemctl start mariadb
[root@Centos7 ~]# mysql -e "create database wordpress;grant all on wordpress.* to wpuser@'192.168.37.%' identified by 'centos';flush privileges;"
验证:http://192.168.37.7/wordpress

Q3、收集apache访问日志,并实现图形化展示。
#server-A
[root@Centos7 wordpress]# yum install php-gd rsyslog-mysql -y
[root@Centos7 wordpress]# tar -xf ~/loganalyzer-4.1.10.tar.gz -C ~/
[root@Centos7 wordpress]# cd ..
[root@Centos7 html]# cp -r ~/loganalyzer-4.1.10/src/ logs
[root@Centos7 html]# touch logs/config.php
[root@Centos7 html]# chmod 666 logs/config.php
[root@Centos7 html]# vim /etc/rsyslog.conf
$ModLoad ommysql
*.info;mail.none;authpriv.none;cron.* :ommysql:192.168.37.17,Syslog,loguser,centos
[root@Centos7 html]# scp /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql 192.168.37.17:/root
[root@Centos7 html]# vim /etc/httpd/conf/httpd.conf
#Options Indexes FollowSymLinks
DirectoryIndex index.php index.html
[root@Centos7 html]# setfacl -Rm u:apache:rwx logs/
[root@Centos7 html]# systemctl restart httpd rsyslog
#server-B
[root@Centos7 ~]# mysql < /root/mysql-createDB.sql
[root@Centos7 ~]# mysql -e "grant all on Syslog.* to loguser@'192.168.37.%' identified by 'centos';flush privileges;"
[root@Centos7 ~]# mysql -e "use Syslog;show tables"
+------------------------+
| Tables_in_Syslog |
+------------------------+
| SystemEvents |
| SystemEventsProperties |
+------------------------+
安装 loganalyzer: http://192.168.37.7/logs/install.php





主页查看:http://192.168.37.7/logs/index.php

网友评论