1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块
第一台设备
[root@zuoye1 ~]# yum install httpd php php-mysql
[root@zuoye1 ~]# cat /var/www/html/lamp.php
<?php
try {
$user='root';
$pass='123456';
$dbh = new PDO('mysql:host=10.0.0.101;port=3306;dbname=mysql', $user, $pass);
foreach($dbh->query('SELECT user,host from user') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
phpinfo();
?>
[root@zuoye1 ~]# systemctl start httpd
第二台设备
[root@zuoye2 ~]# yum install -y mariadb
[root@zuoye2 ~]# systemctl start mariadb
xcache官网上不去,暂未做。
2、部署wordpress论坛,并实现正常访问登录论坛。
[root@zuoye4 ~]# yum -y install httpd php php-json php-mysql mariadb-server
[root@zuoye4 ~]# systemctl start mariadb httpd
[root@zuoye4 ~]# mysql
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> grant all on wordpress.* to wordpress@'localhost' identified by '123456';
[root@zuoye4 ~]# wget https://cn.wordpress.org/latest-zh_CN.zip
[root@zuoye4 ~]# unzip latest-zh_CN.zip
[root@zuoye4 ~]# mv wordpress/* /var/www/html/
[root@zuoye4 ~]# chown -R apache:apache /var/www/html/
使用浏览器登录http://10.0.0.103/wordpress
按照提示填写相关参数即可
最终结果
3、收集apache访问日志,并实现图形化展示。
下载loganalyzer软件
[root@zuoye1 ~]# wget -c https://download.adiscon.com/loganalyzer/loganalyzer-4.1.11.tar.gz
解压
[root@zuoye1 ~]# tar xvf loganalyzer-4.1.11.tar.gz
将软件移至网页目录下
[root@zuoye1 ~]# mkdir /var/www/html/log
[root@zuoye1 ~]# cp -rf loganalyzer-4.1.11
[root@zuoye1 ~]# cp -rf loganalyzer-4.1.11/src/ /var/www/html/log/
设置HTTP主机
[root@zuoye1 loganalyzer-4.1.11]# cat /etc/httpd/conf.d/test.conf
<virtualhost *:80>
documentroot /var/www/html/
ErrorLog /var/log/x.err
CustomLog /var/log/x.access combined
<directory /var/www/html/>
require all granted
</directory>
</virtualhost>
[root@zuoye1 loganalyzer-4.1.11]# systemctl restart httpd
使用浏览器登录安装
http://10.0.0.100/log/src/install.php
安装之后结果如下