1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品
1、環境:
兩台機器:
192.168.43.137 httpd php-fpm php-mysql
192.168.43.108 mariadb
2、137上安裝httpd、 php-fpm 、php-mysql
[root@ka2 conf.modules.d]#yum install httpd php-fpm php-mysql
3、建立session目錄,確定運作php-fpm程序的使用者對session目錄有讀寫權限
[rot@ka2 conf.modules.d]#mkdir /var/lib/php/session
[root@ka2 conf.modules.d]#chown apache.apache /var/lib/php/session
4、建立httpd的fcgi配置檔案,将通路.php檔案指定到具體目錄:
[root@ka2 conf.modules.d]#vim /etc/httpd/conf.d/fcgi.conf
DirectoryIndex index.php
ProxyRequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html/$1

5、驗證http是否支援fcgi
[root@ka2 conf.modules.d]#httpd -M|grep fcgi
proxy_fcgi_module (shared)
6、重新開機httpd服務,啟動php-fpm服務:
[root@ka1 conf.d]#systemctl restart httpd
[root@ka1 html]#systemctl start php-fpm
7、編譯安裝xcache:
[root@ka1 apps]#yum -y install php-devel
[root@ka1 apps]#phpize
[root@ka1 apps]#tar xvf /app/xcache-3.2.0.tar.gz -C /apps/
[root@ka1 apps]#cd xcache-3.2.0/
[root@ka1 xcache-3.2.0]#./configure --enable-xcache
[root@ka1 xcache-3.2.0]#make && make install
[root@ka1 xcache-3.2.0]#cp xcache.ini /etc/php.d/
[root@ka1 xcache-3.2.0]#ll /usr/lib64/php/modules/ |grep xcache
-rwxr-xr-x 1 root root 702000 Apr 9 21:53 xcache.so
[root@ka1 xcache-3.2.0]#systemctl restart httpd.service
8、在192.168.43.108上安裝mariadb服務
[root@centos7 ~]#yum install mariadb-server![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。
2、部署wordpress論壇,并實作正常通路登入論壇。
在1的環境之上
1、将wordpress-5.0.3-zh_CN.tar.gz 解壓後放到http的預設站點/var/www/html/裡:
2、确認httpd的fcgi配置:
[root@ka1 html]#cat /etc/httpd/conf.d/fcgi.conf
DirectoryIndex index.php
ProxyRequests Off
或者将wordpress的配置單獨放在一個配置檔案中:![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。 ![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。
3、建立wordpress所需的資料庫和使用者:
MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on wpdb.* to wpuser@'%' identified by "123456";
Query OK, 0 rows affected (0.00 sec)
4、将wordpress服務apache使用者rwx權限:
[root@ka1 conf.d]#setfacl -R -m u:apache:rwx /apps/vhosts/wordpress
5、重新開機httpd服務:
[root@ka1 html]#systemctl restart httpd
6、通路http://192.168.43.137/wordpress 或者 wordpress.wang.com/wordpress,進行安裝:
![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。 ![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。 ![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。 ![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。 ![]()
第十七周1、部署分離的LAMP,部署到二台伺服器上,php加載xcache子產品2、部署wordpress論壇,并實作正常通路登入論壇。3、收集apache通路日志,并實作圖形化展示。
7、登入
3、收集apache通路日志,并實作圖形化展示。
接着以上的實驗環境:
192.168.43.137 日志伺服器
192.168.43.108 mariadb伺服器
1、在日志伺服器137 上上安裝mysql子產品相關的程式包rsyslog-mysql:
#yum install rsyslog-mysql
#rpm -ql rsyslog-mysql
/usr/lib64/rsyslog/ommysql.so
/usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
2、在108上授權rsyslog使用者能連接配接至目前伺服器:
MariaDB [(none)]> GRANT ALL ON Syslog.* TO 'Syslog'@'192.168.43.%' IDENTIFIED BY '123456';
3、在107上将/usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql導入到108的mariadb中,進行建立資料庫:
#mysql -uSyslog -p123456 -h192.168.43.108 < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
4、改日志伺服器rsyslog的配置檔案/etc/rsyslog.conf
MODULES
$ModLoad ommysqlRULES ####将local5日志寫到mysql資料庫中
local5.* :ommysql:192.168.43.108,Syslog,Syslog,123456
重新開機rsyslog服務:
#systemctl restart rsyslog
5、修改日志伺服器137上htpd配置,修改http的日志配置:
vim /etc/httpd/conf/httpd.conf
CustomLog "logs/access_log" combined
CustomLog "|/usr/bin/logger -p local5.info" combined
重新開機httpd服務:
#systemctl restart httpd
6、日志伺服器137上準備amp或nmp組合
yum install httpd php php-mysql php-gd
7、在日志伺服器137上安裝logLogAnalyzer:
#tar xf loganalyzer-4.1.7.tar.gz
#cp -a loganalyzer-4.1.7/src/ /apps/vhosts/loganalyzer
#cd /apps/vhosts/loganalyzer
#touch config.php
#chmod 666 config.php
在http中添加虛拟主機:
[root@ka1 vhosts]#vim /etc/httpd/conf.d/vhosts.conf
<VirtualHost :80>
ServerName logs.wang.com
DocumentRoot /apps/vhosts/
ProxyPassMatch ^/(..php)$ fcgi://127.0.0.1:9000/apps/vhosts/$1
<Directory "/apps/vhosts/">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
改檔案全新,否則報錯
#chmod 777 /var/lib/php/session
修改hosts檔案:
192.168.43.137 logs.wang.com
重新開機httpd:
systemctl start httpd.service
8、通路:http://logs.wang.com/Loganalyzer 進行安裝
-----完成-----