搭建前准备:

  1.两台独立主机

    httpd:192.168.1.105

    php-fpm:192.168.1.105

    mariadb:192.168.1.103

  2.相关软件的源码包

    httpd:httpd-2.4.23

    php:php-5.6.28

    mysql:mariadb-5.5.53

  3.开发环境及依赖包组

    包:apr-1.4+,apr-util-1.4+,pcre-devel;

    包组:Development Tools;Server Platform Development

开始搭建:

  第一台主机安装httpd和php:

  1.编译安装httpd

    ①编译安装apr-1.4和apr-util-1.4

/*apr-1.4*/
./configure --prefix=/usr/local/apr
make && make install /*apr-util-1.4*/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

    ②编译安装httpd

./configure --prefix=/usr/local/apache2.4
--sysconfdir=/etc/httpd2.4 //配置文件存放路径
--with-zlib //依赖zlib所提供的压缩功能
--with-pcre //支持perl的正则表达式
--with-mpm=prefork //指明mpm为prefork模式
--with-apr=/usr/local/apr //依赖apr的存放路径
--with-apr-util=/usr/local/apr-util //依赖apr-util的存放路径
--enable-so //支持DSO机制
--enable-ssl //支持ssl
--enable-cgi //支持cgi机制
--enable-rewrite //支持url重写
--enable-modules=most //启用多少模块,有most/all等值
--enable-mpms-shared=all //编译哪些MPM模块

    ③导出httpd2.4的头文件

      # ln -sv /usr/local/apache24/include /usr/include/httpd

    ④为httpd2.4提供服务启动脚本

#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO # Source function library.
. /etc/rc.d/init.d/functions #if [ -f /etc/sysconfig/httpd ]; then
# . /etc/sysconfig/httpd
#fi # Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"} # This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS="" # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start. # Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache24/bin/apachectl
httpd=${HTTPD-/usr/local/apache24/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/usr/local/apache24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10} # The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
} # When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
} # See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac exit $RETVAL

    将httpd24这个脚本加入到系统服务:

    # chkconfig --add httpd24

    # vim /etc/httpd24/conf/httpd.conf

    

    

    如果基于虚拟主机进行演示的话,此处还需要注释DocumentRoot,此处附上基于虚拟主机配置的配置文件:   

DirectoryIndex index.php
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot "/usr/local/apache24/www/demo1"
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://192.168.1.105:9000/www/test1/$1
<Directory "/usr/local/apache24/www/demo1">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>

    至此,服务可以正常启动了,接下来开始编译安装php:

    可能需要用到的相关依赖包:

      bzip2-devel,libmcrypt-devel,libxml2-devel

    ①编译安装php

./configure --prefix=/usr/local/php56
--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-mcrypt
--with-config-file-path=/etc/php56
--with-config-file-scan-dir=/etc/php56.d
--with-bz2
--enable-fpm //关键选项

    ②配置文件和服务的相关操作  

    #cp php.ini-development /etc/php.ini

    #cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm (将php-fpm加入到系统服务中)

    #chkconfig --add php-fpm

        查看添加结果:#chkconfig --list php-fpm

    php-fpm配置文件的相关配置:

    

    配置完成后,创建相应的测试页(在此不再赘述)并启动httpd24和php-fpm服务测试即可,测试效果如下:

    静态资源:

    

    动态资源:

    

   最后的mysql参考lnmp那篇博客,再次不再演示

CentOS 6.5 源码编译搭建LAMP(两台独立主机实现)的更多相关文章

  1. CentOS 6.5 源码编译搭建LNMP(三台独立主机实现)

    搭建前准备: 1.三台独立主机 nginx:192.168.1.102 php-fpm:192.168.1.105 mysql:192.168.1.103 2.相关软件的源码包 nginx:nginx ...

  2. 源码编译搭建LAMP

    环境版本信息: RHEL 5.3 Apache / 2.4.16 PHP / 5.4.45 mysql-5.5.45 源代码编译 安装方式 1: configure 配置 以及定制我们的软件包 2: ...

  3. Centos 7.x 源码编译搭建Nginx

    环境: centos 7 防火墙关闭 Selinx关闭 Nginx Web安装 安装依赖库 yum install pcre-devel pcre gcc gcc-c++ zlib zlib-deve ...

  4. CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境

    CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境 什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/ ...

  5. CentOS 7.4 源码编译安装 Redis

    一.CentOS 7.4  源码编译安装 Redis 1.下载源码并解压 wget http://download.redis.io/releases/redis-4.0.10.tar.gz tar ...

  6. centos7源码编译安装lamp/lnmp

    centos7源码编译安装lamp/lnmp 进程:是包工头(相当于是个门,只管开门关门,不管门内的事儿) 线程:是各种工种(cpu调度的是线程) 进程 是一件事情, 线程 是 同一个时间范围内 同时 ...

  7. 源码编译安装LAMP环境及配置基于域名访问的多虚拟主机

    实验环境及软件版本: CentOS版本: 6.6(2.6.32.-504.el6.x86_64) apache版本: apache2.2.27 mysql版本:  Mysql-5.6.23 php版本 ...

  8. centos 6.5源码编译安装subversion 1.8.10

    一.简介 CentOS 6.5的yum源可以安装的SVN客户端版本太低了,1.6.11,所以需要升级到1.8.10,而官网有没有找到1.8.10的安装包,只能选择源码编译安装. 二.安装步骤 参考官网 ...

  9. 源码编译搭建LNMP环境

    LNMP源码编译 1.LNMP介绍 LNMP=Linux Nginx Mysql PHP Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器.Ng ...

随机推荐

  1. NOI2019网络同步赛总结

    先说说分数:\(100+20+0+100+0+0=220\) 我果然还是个大蒟蒻-- Day1 比赛之前还在回顾着<灵笼>,时间一到就立刻进入比赛. 快速地浏览了一遍题目,然后开始刚T1. ...

  2. 【JZOJ5431】序列操作

    description 一开始有n个非负整数hi,接下来会进行m次操作,第i次操作给出一个数c[i],要求你选出c[i]个大于零的数并将它们减去1. 问最多可以进行多少轮操作后无法操作(即没有c[i] ...

  3. python3和python2编码拾遗

    py2编码 tr和unicode str和unicode都是basestring的子类.严格意义上说,str其实是字节串,它是unicode经过编码后的字节组成的序列.对UTF-8编码的str'苑'使 ...

  4. Windows route

    ROUTE [-f] [-p] [-4|-6] command [destination]                  [MASK netmask]  [gateway] [METRIC met ...

  5. Delphi利用Windows GDI实现文字倾斜

    Delphi利用Windows GDI实现文字倾斜 摘要 Delphi利用Windows GDI实现文字倾斜 procedure TForm1.FormPaint(Sender: TObject);v ...

  6. 如何将制定目录加入到PYTHONPATH

    1 问题背景 TensorFlow Object Detection API 是以Slim为基础实现的,需要将Slim的目录加入PYTHONPATH后才能正确运行. 2 机器环境 window10 a ...

  7. java_打印流

    public class transientTest { /** * 反序列化操作2 * 序列化后的文件被修改后进行反序列化时会报错 * 决绝方法: * 手动添加序列号Serializable中有声明 ...

  8. 如何为ABAP程序添加权限检查

    一.确认权限对象,及其关联字段: TCode: SU21 例如权限对象"M_MSEG_WMB",它关联字段为"WERKS",详见下图: 二.在ABAP代码中添加 ...

  9. JS流程控制语句 反反复复(while循环) 和for循环有相同功能的还有while循环, while循环重复执行一段代码,直到某个条件不再满足。

    反反复复(while循环) 和for循环有相同功能的还有while循环, while循环重复执行一段代码,直到某个条件不再满足. while语句结构: while(判断条件) { 循环语句 } 使用w ...

  10. python Selenium chromedriver 自动化超时报错:你需要使用多标签保护罩护体

    在使用selenium + chrome 作自动化测试的时候,有可能会出现网页连接超时的情况 如果出现网页连接超时,将会导致 webdriver 也跟着无法响应,不能继续进行任何操作 即时是去打开新的 ...