编译安装httpd-2.4.9

author author     2022-08-14     150

关键词:

(一)介绍:

  Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python解释器编译到服务器中。同时Apache音译为阿帕奇,是北美印第安人的一个部落,叫阿帕奇族,在美国的西南部。也是一个基金会的名称、一种武装直升机等等。   

(二)安装方式|版本

    安装方式(1.编译安装 2.rpm包安装)

    版本(httpd-2.0  httpd-2.2  httpd-2.4最新版本) 

(三)httpd2.4新特性:

1) MPM支持运行时装载

--enable-mpms-shared=all --with-mpm=prefork|worker|event

2) 支持event MPM

3) 异步读写支持

4) 支持每模块及每目录分别使用不同的日志级别

5) 支持per-request(即支持<If>, <ElseIf>, and <Else>条件判断)

6) 增强版的表达式分析器;

7) 支持毫秒级keepalive timeout;

8) 基于FQDN(域名)的虚拟主机不再需要NameVirtualHost; 

9) 支持用户使用自定义变量; 

新增模块:mod_proxy_fcgi, mod_ratelimit, mod_request, mod_remoteip

备注:2.4版本修改了一些配置机制:不再支持使用order, allow, deny来实现基于IP的访问控制;

(四)编译安装:

  编译前:编译依赖开发环境,yum groupinstall Development tools Server Platform Development -y

    编译三部曲:检查编译环境,编译,安装

    编译安装apr和apr-util

       tar xf apr-1.5.0.tar.bz2 

       cd apr-1.5.0

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

       make && make install

       tar xf apr-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

    编译安装httpd2.4

      cd httpd-2.4.9

      ./configure --prefix=/usr/local/apache  --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  && make && make install         #编译模块

 

    vim /etc/rc.d/init.d/httpd   #提供服务脚本  

#!/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/sbin/apachectl

httpd=${HTTPD-/usr/sbin/httpd}

prog=httpd

pidfile=${PIDFILE-/var/run/httpd/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

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.

        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() {

        status -p ${pidfile} $httpd > /dev/null

        if [[ $? = 0 ]]; then

                echo -n $"Stopping $prog: "

                killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd

        else

                echo -n $"Stopping $prog: "

                success

        fi

        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 [email protected]

        RETVAL=$?

        ;;

  *)

        echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"

        RETVAL=2

esac


exit $RETVAL


(五)启动测试

  service httpd start

(六)httpd工具

   httpd命令是Apache HTTP服务器程序。

     参数说明

  • -c<httpd指令> 在读取配置文件前,先执行选项中的指令。

  • -C<httpd指令> 在读取配置文件后,再执行选项中的指令。

  • -d<服务器根目录> 指定服务器的根目录。

  • -D<设定文件参数> 指定要传入配置文件的参数。

  • -f<设定文件> 指定配置文件。

  • -h 显示帮助。

  • -l 显示服务器编译时所包含的模块。

  • -L 显示httpd指令的说明。

  • -S 显示配置文件中的设定。

  • -t 测试配置文件的语法是否正确。

  • -v 显示版本信息。          

  • -V 显示版本信息以及建立环境。             

  • -X 以单一程序的方式来启动服务器。


编译安装lamp

一、编译安装apache1、解决依赖关系,先下载好这三个包httpd-2.4.9,apr-1.5.0.tar.bz2,apr-util-1.5.3.tar.bz22、准备开发环境,安装DevelopmentTools,ServerPlatformDevelopment;使用命令yumgroupinstall,这里不多阐述;3、编译安装apr-1.5.0.tar.bz24、编... 查看详情

lnmp服务搭建

LNMP服务搭建解压yusm源码包编译yusm源码生成数据安装yasm开源汇编器解压libmcrypt包编译libmcrypt生成数据安装程序解压libvpx包编译生成安装解压tiff包编译生成安装解压libpng编译生成安装解压frertype编译生成安装解压jpeg编译生成安装... 查看详情

lamp编译安装

lamp编译安装================================================================================编译安装amp 1.编译前环境准备及相关介绍★系统环境:CentOS6,7CentOS6:apr,apr-util的版本为1.3.9,不适用于httpd-2.4的编译安装;CentOS7:apr,apr-util的 查看详情

编译安装——什么是开放源代码编译器与可执行文件——编译安装nginx(代码片段)

目录编译安装nginx1.下载源码包2.解压源码包3.进入解压后的文件夹4.configure配置-->生成Makefile文件5.make编译然后安装6.启动nginx通过configure与make进行编译示意图为什么要编译安装?自己决定功能的多少                ... 查看详情

源码编译安装lnmp环境

一、源码编译安装步骤首先说明源码安装的好处  速度快,可自定义路径主要有三步:1.配置进入源码安装包 ./configure--prefix=/uer/local/nginx 可指定参数--prefix为安装路径2.编译相当于rpm包 make3.安装makeinstall如果安... 查看详情

源码编译安装lamp

一、概述1、源码编译安装LAMP为什么要源码编译      一般来说,我们软件的安装方式有yum(rpm),和源码编译两种方式,那么为什么我们需要源码编译安装一部分软件?选择源码编译安装软件有以下几个原... 查看详情

codeblocks安装后无法编译

codeblocks安装后无法编译:解决办法:  1.下载自带编译器的codeblock安装包。  2.安装完后。修改配置  (1)打开软件,选择setting->Compiler  (2)在编译器设置页面手动浏览找到MinGW文件夹,或选择autodetect,就可以完成... 查看详情

lamp编译安装(代码片段)

lamp编译安装CentOS6:PHP-5.3.2之前:默认不支持fpm机制;需要自行打补丁并编译安装httpd-2.2:默认不支持fcgi协议,需要自行编译此模块解决方案:编译安装httpd-2.4,php-5.3.3+CentOS7:httpd-2.4:rpm包默认编译支持fcgi模块php-fpm包:专用于... 查看详情

编译安装lamp

题目:在LAMP架构中,请分别以php编译成httpd模块形式和php以fpm工作为独立守护进程的方式来支持httpd,列出详细的过程。本次实验以CentOS7为搭建环境,并且已经使用源码编译安装了httpd-2.4(默认使用prefork模块)和使用通用二进... 查看详情

centos编译安装php开发环境

CentOS编译安装PHP开发环境最近在安装服务器开发环境,踩了不少坑,这里总结下来.yum安装虽然简单,却不灵活,版本也比较老旧不合符设计中的选型,因此只使用yum安装一些依赖库,目标软件采用编译安装.目录安装PHP安装PHP扩展安装Phal... 查看详情

编译安装mysql

编译安装MySQL1、安装MySQL需要的依赖包和编译软件(1)安装MySQL需要的依赖包#yum install ncurses-devel libaio-devel -y(2)安装编译MySQL需要的软件#ls -lh cmake-2.8.8.tar.gz#tar xf cmake-2.8.8.tar.gz#cd& 查看详情

源码包编译

1.源码编译介绍源码安装就是将开发人员写好的源码文件进行手动编译安装。目前开源软件,并不是所有的源代码都打成包,如果想使用开源软件,是需要自己下载进行编译安装。需要进行编译安装的场景:软件提供商没有做打... 查看详情

eclipse安装jad反编译插件(在线安装)

Help→EclipseMarketplace→Find→jad然后等安装完成重启eclipse即可 查看详情

redis编译安装问题记录

redis编译安装过程中出现问题汇总:通过解压方式安装,tar-zvxfredis-3.2.9.tar.gz进入解压后的文件目录,如下cd/home/redis-3.2.9/进行编译安装,在编译安装过程中出现如下错误:[[email protected]redis-3.2.9]#makecdsrc&&makeallmake[1]:进... 查看详情

程序包的编译安装

程序包的编译安装之所以需要安装编译程序包,是为了能及时更新程序包,制作好的rpm包,版本一般都有点老了,所以编译安装是必报的,而且我们可以自己定义安装路径,想卸载直接删除就KO了; 在centos7.3环境下安装apacheh... 查看详情

源码编译安装lnmp架构环境

源码编译安装LNMP架构环境OS版本:2.6.32-431.el6.x86_64Nginx版本:nginx-1.6.1mariadb版本:mariadb-10.0.13php版本:php-5.4.261、安装编译安装所需系统环境~]#yumgroupinstall"DevelopmentTools""ServerPlatformDevelopment"-y2、编译安装nginx-1.6.1#yum 查看详情

apache编译安装

查看详情

编译安装cmatrix-2.0(代码片段)

编译安装cmatrix-2.0还记得《***帝国》矩阵图吗?接下来我们编译安装“最新”cmatrix-2.0,实现动态矩阵数字雨。安装准备OS版本信息下载源码包wget‘https://github.com/abishekvashok/cmatrix/archive/v2.0.tar.gz‘安装编译环境yum-yinstallgccautoconfaut... 查看详情