1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块,并且部署wordpress论坛,并实现正常访问登录论坛。
-->一台部署:apache+php 编译安装,一台编译二进制mariadb-server
软件版本:
apr-1.7.0.tar.bz2
apr-util-1.6.1.tar.bz2
httpd-2.4.39.tar.bz2
php-7.3.7.tar.xz
Discuz_X3.3_SC_UTF8.zip
wordpress-5.2.2.tar.gz
mariadb-10.2.25-linux-x86_64.tar.gz
-->1-编译安装实现mariadb
tar xvf mariadb-10.2.25-linux-x86_64.tar.gz -C /usr/local
cd /usr/local
ln -s mariadb-10.2.25-linux-x86_64 mysql
cd mysql
chown -R root.mysql ./
mkdir /mydata/data -p
chown -R mysql.mysql /mydata/data
mkdir /etc/mysql
cp support-files/wsrep.cnf /etc/mysql/my.cnf
更改配置文件:vim /etc/my.cnf
linux--17week
export PATH=/usr/local/mysql/bin/:$PATH --增加环境变量
cd /usr/local/mysql;scripts/mysql_install_db --user=mysql --datadir=/mydata/data
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
service mysqld start
增加用户和授权:
mysql>create database wpdb;
mysql>grant all on wpdb.
to wpuser@'192.168.10.%' identified by 'centos';

-->2-实现编译安装httpd
1)安装相关的包
yum install gcc prce-devel openssl-devel expat-devel -y
2)编译安装
for i in *.bz2 ;do tar xvf $i;done
mv apr-1.7.0 httpd-2.4.39/srclib/apr
mv apr-util-1.6.1 httpd-2.4.39/srclib/apr-util

useradd -r -s /sbin/nologin apache
linux--17week
cd httpd-2.4.39/ --编译配置

./configure \
--prefix=/app/httpd24 \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--with-included-apr \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork
make -j 2 && make install --编译安装
环境变量和启动
echo 'PATH=/app/httpd24/bin:$PATH' > /etc/profile.d/httpd24.sh
. /etc/profile.d/httpd24.sh
更改配置文件:vim /app/httpd24/conf/httpd.conf
--增加两个策略模块
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
DirectoryIndex index.php index.html
--更改用户
User apache
Group apache
--添加配置
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ProxyRequests Off

:80>
servername www.a.com
documentroot /data/wordpress

require all granted

ProxyPassMatch ^/(..php)$ fcgi://127.0.0.1:9000/data/wordpress/$1

linux--17week_第1张图片
mkdir -p /data/wordpress

setfacl -Rm u:apache:rwx /data/wordpress
-->3 实现编译安装php
1) yum install libxml2-devel bzip2-devel libmcrypt-devel
2)
tar xvf php-7.3.7.tar.xz
cd php-7.3.7/
./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockets --enable-fpm --enable-maintainer-zts --disable-fileinfo
make && make install
3)创建配置文件:
cp php.ini-production /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd /app/php/etc
cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d/
cp www.conf.default www.conf
更改配置文件:vim www.conf
user = apache
group = apache
linux--17week_第2张图片
启动:service php-fpm start
-->4-配置wordpress
unzip wordpress-5.4.1-zh_CN.zip
mv wordpress /data/
chown -R root.apache wordpress/
cp wp-config-sample.php wp-config.php
更改配置文件:
vim wp-config.php
linux--17week_第3张图片
service php-fpm restart --重启php-fpm
验证:
linux--17week_第4张图片

2、收集apache访问日志,并实现图形化展示。
-->准备两台机器:
(1) 准备MySQL Server
yum -y install mariadb-server
systemctl start mariadb
GRANT ALL ON Syslog.* TO 'loguser'@'192.168.10.%' IDENTIFIED BY 'centos';
(2) 在rsyslog服务器上安装mysql模块相关的程序包
yum install rsyslog-mysql
mysql -uroot < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
(3) 配置rsyslog将日志保存到mysql中: vim /etc/rsyslog.conf
linux--17week
linux--17week

MODULES

$ModLoad ommysql
-->另一台机器:
(1) 在rsyslog服务器上准备amp或nmp组合
yum install httpd php php-mysql php-gd
(2) 安装LogAnalyzer
tar xf loganalyzer-4.1.10.tar.gz
cp -a loganalyzer-4.1.10/src /var/www/html/loganalyzer
cd /var/www/html/loganalyzer
touch config.php
chmod 666 config.php
(3)启动httpd和rsyslog,进行验证:
linux--17week_第5张图片
linux--17week_第6张图片