Centos6部署lamp: httpd2.4+module模式

前端之家收集整理的这篇文章主要介绍了Centos6部署lamp: httpd2.4+module模式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

系统: Centos6

httpd版本: 2.4 使用event工作模式

PHP版本: 5.4.26

mariadb版本: 5.5.46

xcache版本: 3.0.3

安装顺序: PHP最后安装

一、准备源码包:

wKioL1hqDnfSHjMzAAFDnnKUCNo125.png

二、安装httpd:

1.安装所需环境

yum groupinstall -y"Development tools" "Server Platform Development"

yum install -y pcre-devel

2.安装apr

tar -xjvf apr-1.5.0.tar.bz2

cd apr-1.5.0

./configure--prefix=/usr/local/apr

make & make install

tar -xjvfapr-util-1.5.3.tar.bz2

cd apr-util-1.5.3

./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make && make install

3.安装httpd

wKiom1hqDqOTO55DAAC1EEcxYVk554.png

tar -xjvf httpd-2.4.9.tar.bz2

cd httpd-2.4.9

./configure --prefix=/usr/local/apache--sysconf=/etc/httpd24--enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--enable-modules=most--enable-mpms-shared=all --with-mpm=event

//默认使用event工作模式

make && make install

4.后续工作

vim/etc/profile.d/http24.sh

wKioL1hqDrrhzzzGAABf5SlCxGg958.png

./etc/profile.d/http24.sh

ln -s /usr/local/apache/include//usr/include/httpd24

echo"MANPATH /usr/local/apache/man/" >> /etc/man.config

cp/etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24

vim/etc/rc.d/init.d/httpd24

wKiom1hqDtHQ_uwHAAF5TL6AOvM388.png

vim/etc/httpd24/httpd.conf

wKiom1hqDubQHJDHAAD4J9jIuBU340.png

chkconfig--add httpd24

chkconfig--level 35 httpd24 on

wKioL1hqDvqR2_4BAABxhKa784s094.png

servicehttpd24 start

三、安装mariadb:

1.准备MysqL组和用户

groupadd -r -g 306 MysqL

useradd -r -g MysqL -u 306 MysqL

wKioL1hqDw-zILsAAABwNtHRmF0902.png

2.部署mariadb

tar-xzvf mariadb-5.5.46-linux-x86_64.tar.gz -C /usr/local/

ln -s/usr/local/mariadb-5.5.46-linux-x86_64/ /usr/local/MysqL

wKiom1hqDyWipM65AAHO1igokWU878.png

cd/usr/local/MysqL/

chown-R root:MysqL ./*

wKiom1hqDzygjWDlAAMbaEphcks086.png

3.初始化数据库

mkdir-p /mydata/data

chown MysqL:MysqL /mydata/data/ //准备数据库存放目录

/usr/local/MysqL/scripts/MysqL_install_db--user=MysqL --basedir=/usr/local/MysqL --datadir=/mydata/data/

//指定mariadb目录和数据库存放目录

4.准备配置文件

mkdir/etc/MysqL

cp/usr/local/MysqL/support-files/my-large.cnf /etc/MysqL/my.cnf

vim /etc/MysqL/my.cnf

wKiom1hqD4Py1gtaAAJ7Ar0wm34289.png

5.后续工作

vim /etc/profile.d/MysqLd.sh

wKiom1hqD52TxVAPAABhPl-nkZY947.png

. /etc/profile.d/MysqLd.sh

echo '/usr/local/MysqL/lib/'> /etc/ld.so.conf.d/MysqLd.conf

ldconfig

ln -s/usr/local/MysqL/include/MysqL/ /usr/include/MysqLd

echo 'MANPATH/usr/local/MysqL/man/' >> /etc/man.config

cp/usr/local/MysqL/support-files/MysqL.server /etc/rc.d/init.d/MysqLd

chkconfig --add MysqLd

chkconfig MysqLd on //设置开机启动

wKioL1hqD7KiVWmkAACUhCT25Pw365.png

service MysqLd start

6.安全初始化

/usr/local/MysqL/bin/MysqL_secure_installation

四、安装PHP:

1.解决依赖关系

yum install -y bzip2-devellibmcrypt-devel libxml2-devel

2.安装PHP

tar -xjvf PHP-5.4.26.tar.bz2

cd PHP-5.4.26

./configure --prefix=/usr/local/PHP--with-MysqL=/usr/local/MysqL --with-openssl--with-MysqLi=/usr/local/MysqL/bin/MysqL_config --enable-mbstring--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml--enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt--with-config-file-path=/etc/PHP--with-config-file-scan-dir=/etc/PHP/PHP.d --with-bz2 --enable-maintainer-zts

//使PHP支持多线程

make && make install

mkdir /etc/PHP //用于存放PHP配置文件,要和编译时指定的一致

cp PHP.ini-production/etc/PHP/PHP.ini

3.配置hpttd

vim /etc/httpd24/httpd.conf

wKiom1hqD-mQMXFrAABsCtpKl6c417.png

wKioL1hqD__QGOT-AADhbDRNAtk516.png

service httpd24 reload //重载配置

wKiom1hqEB3SSYjHAALMYWX7tz8169.png

测试

vim /usr/local/apache/htdocs/index.PHP //测试PHP页面

wKioL1hqEDaAVfSYAAAqiQmoixw265.png

wKiom1hqEEvhgNZ-AAJEUbWjQWI295.png

vim/usr/local/apache/htdocs/db.PHP//测试连接mariadb

wKioL1hqEGXDw5jXAACsHHSURSU537.png

wKiom1hqEH2DRgBWAAF7h9J5TSo072.png

五、整合xcache:

1.安装xcache

tar -xjvf xcache-3.0.3.tar.bz2

cd xcache-3.0.3

/usr/local/PHP/bin/PHPize //生成configure

wKioL1hqELmCGf9CAACdP3cHDGQ634.png

./configure --enable-xcache--with-PHP-config=/usr/local/PHP/bin/PHP-config

make && make install

wKioL1hqENCCcPrHAADTiGpfEog937.png

2.整合xcache

mkdir /etc/PHP/PHP.d //用于存放配置文件,要和编译PHP时指定的路径一致

cp xcache-3.0.3/xcache.ini/etc/PHP/PHP.d //复制配置文件

vim /etc/PHP/PHP.d/xcache.ini

wKioL1hqEOii4vyWAAJ14UJMYR4533.png

service httpd24 reload //重载配置文件

wKioL1hqEQPzxik3AAEvUcgCyWI885.png

原文链接:https://www.f2er.com/centos/379234.html

猜你在找的CentOS相关文章