1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块
ip | 服务 |
---|
172.16.0.7 | httpd | 172.16.0.17 | mysql |
#二进制安装mariadb
[root@mysql ~]# tar xf mariadb-10.2.27-linux-x86_64.tar.gz -C /usr/local/
[root@mysql ~]# ln -s /usr/local/mariadb-10.2.27-linux-x86_64/ /usr/local/mysql
[root@mysql ~]# useradd -r -s /sbin/nologin mysql
[root@mysql ~]# chown -R root.root /usr/local/mysql/
[root@mysql ~]# mkdir /data/mysql -p
[root@mysql ~]# mkdir /etc/mysql
[root@mysql ~]# cp /usr/local/mysql/support-files/my-huge.cnf /etc/mysql/my.cnf
[root@mysql ~]# vim /etc/mysql/my.cnf
[mysqld]
datadir =/data/mysql
skip_name_resolve = ON
[root@mysql ~]# echo "PATH=/usr/local/mysql/bin/:$PATH" > /etc/profile.d/lamp.sh
[root@mysql ~]# . /etc/profile.d/lamp.sh
[root@mysql ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql/
[root@mysql ~]# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@mysql ~]# chkconfig --add mysqld
[root@mysql ~]# service mysqld start
#编译安装httpd24
[root@web ~]# wget https:
[root@web ~]# yum -y install gcc make pcre-devel openssl-devel expat-devel
[root@web ~]# tar xf apr-1.7.0.tar.bz2
[root@web ~]# tar xf apr-util-1.6.1.tar.bz2
[root@web ~]# tar xf httpd-2.4.46.tar.bz2
[root@web ~]# mv apr-1.7.0 httpd-2.4.46/srclib/apr
[root@web ~]# mv apr-util-1.6.1 httpd-2.4.46/srclib/apr-util
[root@web ~]# cd httpd-2.4.46
[root@web httpd-2.4.46]# ./configure --prefix=/apps/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
[root@web httpd-2.4.46]# make -j 4 && make install
[root@web ~]# echo "PATH=/apps/httpd24/bin:$PATH" > /etc/profile.d/lamp.sh
[root@web ~]# . /etc/profile.d/lamp.sh
[root@web ~]# useradd -r -s /sbin/nologin apache
[root@web ~]# vim /apps/httpd24/conf/httpd.conf
user apache
group apache
#编译安装php56
[root@web ~]# yum -y install gcc make libxml2-devel bzip2-devel libmcrypt-devel php-mysql
[root@web ~]# tar xf php-5.6.30.tar.gz
[root@web ~]# cd php-5.6.30
[root@web php-5.6.30]# ./configure --prefix=/apps/php \
--with-mysql \
--with-openssl \
--with-mysqli \
--enable-mbstring \
--with-png-dir \
--with-jpeg-dir \
--with-freetype-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--enable-sockets \
--with-apxs2=/apps/httpd24/bin/apxs \
--with-mcrypt \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-bz2
[root@web php-5.6.30]# make -j 4 && make install
[root@web php-5.6.30]# cp php.ini-production /etc/php.ini
[root@web php-5.6.30]# vim /apps/httpd24/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
编译安装xcache加速
[root@web ~]# yum -y install https:
[root@web ~]# yum -y install gcc php56-php-devel
[root@web ~]# tar xf xcache-3.2.0.tar.gz
[root@web ~]# cd xcache-3.2.0
[root@web xcache-3.2.0]# /apps/php/bin/phpize
[root@web xcache-3.2.0]# ./configure --enable-xcache --with-php-config=/apps/php/bin/php-config
[root@web xcache-3.2.0]# make && make install
[root@web xcache-3.2.0]# cat xcache.ini >> /etc/php.ini
[root@web xcache-3.2.0]# apachectl start
2、部署wordpress论坛,并实现正常访问登录论坛。
在mysql服务器
[root@mysql ~]# mysql
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> grant all on wordpress.* to wordpress@'172.16.0.%' identified by '123456';
在web服务器
[root@web ~]# tar xf wordpress-5.4.2.tar.gz
[root@web ~]# mv wordpress
3、收集apache访问日志,并实现图形化展示。
[root@web ~]# yum -y install php php-mysql php-gd
[root@web ~]# wget https:
[root@web ~]# tar xf loganalyzer-4.1.10.tar.gz
[root@web ~]# mv loganalyzer-4.1.10 /apps/httpd24/htdocs/log
[root@web ~]# mv /apps/httpd24/htdocs/log/src
|