1、安裝httpd-2.4.46
(1)yum安裝依賴包
yum -y install sqlite-devel libxml2-devel oniguruma-devel pcre-devel openssl-devel expat-devel
yum -y groupinstall 'development tools'
(2)官網(wǎng)下載httpd-2.4.46、apr-1.7.0、apr-util-1.6.1源碼包
https://downloads.apache.org/
(3)解壓3個(gè)源碼包
tar xf httpd-2.4.46.tar.bz2
tar xf apr-1.7.0.tar.bz2
tar xf apr-util-1.6.1.tar.bz2
(4)將解壓后的 apr和apr-util目錄復(fù)制到解壓后的httpd目錄中
cp -r apr-1.7.0 httpd-2.4.46/srclib/apr
cp -r apr-util-1.6.1 httpd-2.4.46/srclib/apr-util
(5)進(jìn)入解壓后的httpd目錄中生成make文件
./configure --prefix=/app/httpd24 \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork \
--with-included-apr
(6)
make && make install
2、安裝php-7.4.13
(1)安裝依賴包
yum -y install libpng-devel libjpeg-devel freetype-devel
(2)官網(wǎng)下載php源碼包
https://www.php.net/downloads.php
(3)解壓源碼包
tar xf php-7.4.13.tar.bz2
(4)進(jìn)入解壓后的php目錄中生成make文件
./configure --prefix=/app/php \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-openssl \
--with-pdo-mysql=mysqlnd \
--enable-mbstring \
--with-freetype \
--with-jpeg \
--with-zlib \
--libdir=/usr \
--enable-xml \
--enable-sockets \
--enable-fpm \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-maintainer-zts \
--disable-fileinfo \
--enable-gd
(5)
make && make install
(6)將配置文件模板復(fù)制到前面指定的/etc中
cp php.ini-production /etc/php.ini
(7)將啟動(dòng)腳本復(fù)制到systemd目錄中
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
(8)進(jìn)入安裝目錄中,將配置文件模板復(fù)制一份為配置文件
cd /app/php/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
3、配置httpd支持php-fpm
(1)添加apache用戶
useradd -r -s /sbin/nologin apache
(2)修改php-fpm配置
vi /app/php/etc/php-fpm.d/www.conf
修改下面配置
user = apache
group = apache
(3)修改httpd配置文件
vim /app/httpd24/conf/httpd.conf
取消下面兩行的注釋
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
修改下面行
User apache
Group apache
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
加下面四行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1
(4)啟動(dòng)httpd及php-fpm
4、安裝rsyslog-mysql,并配置
(1)
yum -y install rsyslog-mysql
(2)將mysql腳本復(fù)制到mariadb所在服務(wù)器
scp /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql 192.168.34.27:
5、安裝mariadb-10.5.8
(1)創(chuàng)建一個(gè)mariadb官方網(wǎng)站的yum源
vi /etc/yum.repo.d/mariadb.repo
[mariadb]
name=mariadb
baseurl=https://mirrors.ustc.edu.cn/mariadb//mariadb-10.5.8/yum/centos/7/x86_64/
enable=1
gpgcheck=0
(2) 更新yum緩存
yum clean all
yum repolist
(3)yum 安裝 mariadb
yum -y install --enablerepo=mariadb mariadb-server
6、創(chuàng)建數(shù)據(jù)庫(kù)及用戶并配置rsyslog
(1)創(chuàng)建數(shù)據(jù)庫(kù)及用戶
mysql <mysql-createDB.sql
grant all on Syslog.* to loguser@'192.168.34.%' identified by 'centos';
(2)在rsyslog服務(wù)器修改rsyslog配置文件,使日志發(fā)送到mariadb服務(wù)器,
vi /etc/rsyslog.conf
$ModLoad ommysql
*.info;mail.none;authpriv.none;cron.none :ommysql:192.168.34.27,Syslog,loguser,centos
(3)重啟服務(wù)
systemctl restart rsyslog
7、安裝LogAnalyzer
(1)官網(wǎng)下載LogAnalyzer v4.1.11
https://loganalyzer.adiscon.com/download/
(2)解壓后將網(wǎng)站文件復(fù)制到httpd根目錄
cp -r src/* /app/httpd24/htdocs/
(3)創(chuàng)建配置文件
touch config.php
chmod 666 config.php
(4)登錄網(wǎng)站進(jìn)行圖形化安裝。
(5)安裝完成后,更改配置文件權(quán)限
chmod 644 config.php