编译安装HTTPD 2.4.9版本

   服务脚本:/etc/rc.d/init.d/httpd

   脚本配置文件路径:/etc/sysconfig/httpd

   运行目录:/etc/httpd

   配置文件:

       主配置:/etc/httpd/conf/httpd.conf

       扩展配置:/etc/httpd/conf.d/*.conf

   监听的Socket: tcp的80, 443是https/tcp的监听端口

   在内核中使用小于1023的端口的只有管理员

   文档根目录:/var/www/html

   CGI目录:/var/www/cgi-bin/

 
 

   依赖于更高版本的apr和apr-util。apr全称为apache portable runtime(apache运行时移植工具)、是让apache跨平台的工具、是个底层库。

   这里的安装不做过多的详细解释了、可以参考之前写过的文章、安装都是大同小异:

 

 

   实战步骤:

===============================================================================

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

(1) 解决依赖关系

    prel兼容的正则表达式库

    # yum -y install pcre-devel

    # yum -y groupinstall "Server Platform Development"

    # yum -y groupinstall "Development tools"

(2) 编译安装apr-1.5.0

    # tar xf apr-1.5.0.tar.bz2

    # cd apr-1.5.0

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

    # make && make install

(3) 编译安装apr-util-1.5.3

    # 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

 
 

 
 

 
 

 
 

(4) httpd编译安装

    # tar xf httpd-2.4.9.tar.bz2

    # cd httpd-2.4.9

    # ./configure --prefix=/usr/local/apache --sysconfdir=/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

    # make && make install

--prefix=/usr/local/apache:指定安装路径、不使用默认路径

表示版本、为了不跟我本机上的2.2的重复

--enable-so:表示基于DSO动态加载模块的

--enable-ssl:这项是支持https协议的

--enable-cgi:支持CGI机制的

--enable-rewrite:支持URL重写的

--with-zlib:zlib是一个网络上发送数据报文时的一个通用压缩库的API

--with-pcre:通常支持Perl所用到的一个库

--with-apr=/usr/local/apr:指定新的apr的路径

--with-apr-util=/usr/local/apr-util/:指定新的apr-util的路径

--enable-modules=most:most表示启用大多数常用的模块

--enable-mpms-shared=all:所有的MPM模块都编译

--with-mpm=event:明确指定启用event模块

 
 

 
 

   后续的配置:

1) 修改服务脚本
先把 # cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd 24

修改下apache自己的服务脚本 vim /etc/rc.d/init.d/httpd 24 // 修改的部分我会要红色注释

 

#!/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/bin/apachectl //这两行改下路径,
了解你的apachectl安装在哪个路径下
我的是装在 /usr/local/apache/bin

httpd=${HTTPD-/usr/local/bin/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.

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

 
 

       2) 输出二进制程序

 
 

           # vim /etc/profile.d/httpd24.sh

export PATH=/usr/local/apache/bin:$PATH

3) 修改 apache下的 vim /etc/httpd24/httpd.conf

开启
ServerName 172.16.21.1:80 // 172.16.21.1 这是我的本机ip地址

   安装配置好之后我们查看一下刚安装好的HTTPD版本:

   # httpd -v

   最后可以启动了、再查看一下端口是否在监听状态了、当然你还可以给他提供一个服务脚本:

   # apachectl star

   # ss -tnl 

===============================================================================

编译安装HTTPD 2.4.9版本的更多相关文章

  1. apache编译安装 httpd 2.2 httpd 2.4

    #apache编译安装#httpd 2.2 , httpd 2.4 #!/bin/sh #apache编译安装 #httpd 2.2 , httpd 2.4 #centos #rpm -e httpd ...

  2. (转)CentOS 7.6 上编译安装httpd 2.4.38

    原文:https://www.s4lm0x.com/archives/40.html https://www.cnblogs.com/sunshine-H/p/8110608.html----超详细 ...

  3. CentOS 6.4源码编译安装httpd并启动测试

    今天来总结一下在Linux中软件安装,通常我们应该知道,安装软件有两种方法:一种是软件包的安装,也就是rpm包的安装,就是指这些软件包都是 已经编译好的二进制rpm包,我们通过rpm安装工具和yum安 ...

  4. Linux源码编译安装httpd

    Linux安装软件采用源码编译安装灵活自由,适用于不同平台,维护也十分方便. 源码编译的安装方式一般由3个步骤组成: 1.配置(configure) 2.编译(make) 3.安装(make inst ...

  5. 编译安装httpd 2.4

    author:JevonWei 版权声明:原创作品 官方网站下载httpd2.4.apr及apr-util的相关软件包,并传输到centos 7系统中的/usr/local/src(apr1.6版本过 ...

  6. zstack源码编译安装(1.7.x版本)

    图片没粘贴过来,请看本人gitbook吧https://www.gitbook.com/book/jingtyu/how-to-learn-zstack-code 运行环境 zstack的安装方式有很 ...

  7. LAMP环境之编译安装httpd服务

    “Apache HTTP Server”是开源软件项目的杰出代表,它基于标准的 HTTP 网络协议提供网页浏览服务. 在配置 Apache 网站服务之前,需要正确安装好 httpd 服务器软件.htt ...

  8. 编译安装带ssl 模块指定版本Python

      出现这个或者fatal error: openssl/名单.h: No such file or directory.都是没有安装libssl-dev- libssl-dev包含libraries ...

  9. 编译安装httpd

    一.安装前的说明: httpd依赖于apr和apr-util所以在安装httpd之前要把这些东西都安装上去. 事先安装的依赖: yum -y install gcc gcc-c++ pcre-deve ...

随机推荐

  1. 纯css3实现的动画加载条

    之前大大家分享了很多款加载条.今天给大家带来一款纯css3实现的动画加载条. 这款加载条适用浏览器:360.FireFox.Chrome.Safari.Opera.傲游.搜狗.世界之窗. 不支持IE8 ...

  2. hdu1050 Moving Tables

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1050 求区间上点的最大重叠次数. #include <stdio.h> #include &l ...

  3. spring WebServiceTemplate 调用 axis1.4 发布的webservice

     前言: 最近在开发中需要调用对方的 webservice服务,按照现有的技术,本应该是一件很简单的事情,只需要拿到wsdl文件,生成客户端代码即可,但是,对方的webservice服务是06年用ax ...

  4. uva 10252 - Common Permutation 字符串水题

    题意:給定兩個小寫的字串a與b,請印出皆出現在兩字串中的字母,出現的字母由a~z的順序印出,若同字母出現不只一次,請重複印出但不能超過任一字串中出現的次數.(from Ruby兔) 很水,直接比较输出 ...

  5. (三)u-boot2013.01.01 for TQ210:《mkconfig分析》

    /* 和分析makefile一样,分析mkconfig同样注重句法分析 */ ############################################################# ...

  6. SpringMVC 的 Controller 返回各种视图的处理方式

    SpringMVC 的 Controller 可以返回各种各样的视图.比如 JSP, JSON, Velocity, FreeMarker, XML, PDF, Excel, 还有Html字符流 等等 ...

  7. PHP中正则替换函数preg_replace用法笔记

    今天应老板的需求,需要将不是我们的页面修改一个链接,用js+iframe应该也能实现,但是我想尝试一下php实现方法. 首先你得先把别人的页面download到你的php中,实现方法可以用curl, ...

  8. SPOJ 7758. Growing Strings AC自动机DP

    Growing Strings 题目:给出n个字符串,问最多能够选出多少个串组成序列,并满足前一个字符串是后一个字符串的子串. 分析: AC自动机经典水题... 考虑每个节点结尾时,他能够选出最多的串 ...

  9. CKEditor配置及使用

    注:使用CKEditor版本为js版本的CKEditor 4,所有配置均参考自CKEditor官方API:http://docs.ckeditor.com/,以及实践经验 一.快速使用 1.引入CKE ...

  10. 【CSS3】---属性选择器

    在HTML中,通过各种各样的属性可以给元素增加很多附加的信息.例如,通过id属性可以将不同div元素进行区分. 在CSS2中引入了一些属性选择器,而CSS3在CSS2的基础上对属性选择器进行了扩展,新 ...