第十七周

文章目录

  • 第十七周
    • 1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块
    • 2、部署wordpress论坛,并实现正常访问登录论坛
    • 3、收集apache访问日志,并实现图形化展示

第十七周

1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块

两台主机:192.168.175.10,192.168.175.11

192.168.175.10安装httpd,php,xcache

192.168.175.11安装mariadb

安装http,php,xcache

[root@centos7 ~]# yum -y install httpd php php-devel php-mysql gcc
[root@centos7 ~]# wget http://xcache.lighttpd.net/pub/Releases/3.1.2/xcache-3.1.2.tar.gz
[root@centos7 ~]# [root@centos7 ~]# tar xvf xcache-3.1.2.tar.gz
[root@centos7 ~]# cd xcache-3.1.2
[root@centos7 xcache-3.1.2]# phpize
[root@centos7 xcache-3.1.2]# ./configure --enable-xcache
[root@centos7 xcache-3.1.2]# make && make install
[root@centos7 xcache-3.1.2]# systemctl start httpd

安装mariadb

[root@centos7 ~]# yum -y install mariadb-server
[root@centos7 ~]# mysql
MariaDB [(none)]> grant all on test.* to testuser@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

测试

[root@centos7 html]# vi sqltest.php
#添加php代码

[root@centos7 html]# curl 192.168.175.10/sqltest.php
OK

2、部署wordpress论坛,并实现正常访问登录论坛

可以安装wordpress-5.0.4-zh_CN.tar.gz比较旧的版本,或者安装最新版请参考:https://blog.csdn.net/apple2417/article/details/105491858

3、收集apache访问日志,并实现图形化展示

服务器ip:192.168.214.20
安装lamp环境

[root@centos7 ~]# yum -y install httpd php php-mysql rsyslog-mysql mariadb-server

创建数据库

[root@centos7 ~]# mysql < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
[root@centos7 ~]# mysql -e 'grant all on Syslog.* to syslog@'127.0.0.1' identified by "123456";flush privileges;'

修改配置文件

[root@centos7 ~]# vi /etc/httpd/conf/httpd.conf
#修改下面内容
# CustomLog "logs/access_log" combined
  CustomLog "| /usr/bin/logger -p local6.info" combined
  
[root@centos7 ~]# vi /etc/rsyslog.conf
#添加
#### MODULES ####
$ModLoad ommysql
#添加
#### RULES ####
local6.*                                                :ommysql:127.0.0.1,Syslog,syslog,123456
[root@centos7 ~]# systemctl start httpd rsyslog

下载loganalyzer-4.1.10.tar.gz包

[root@centos7 ~]# cd /var/www/html
[root@centos7 html]# wget http://download.adiscon.com/loganalyzer/loganalyzer-4.1.10.tar.gz

安装

[root@centos7 html]# tar xvf loganalyzer-4.1.10.tar.gz
[root@centos7 html]# mv loganalyzer-4.1.10 log
[root@centos7 html]# touch log/src/config.php
[root@centos7 html]# chmod 666 log/src/config.php
[root@centos7 html]# systemctl restart httpd rsyslog
#web安装完后取消权限
[root@centos7 html]# chmod 644 log/src/config.php

访问http://192.168.214.20/log/src/进行web安装,注意安装mysql时Syslog和SystemEvents要区分大小写

你可能感兴趣的:(第十七周)