2019独角兽企业重金招聘Python工程师标准>>>

CentOS7的镜像中已经提供了httpd2.4的rpm包,httpd2.4相对于httpd2.2有较大的改进,在CentOS6下只能通过Apache官方网站提供的源码包编译安装。

httpd2.4新特性:

MPM支持运行DOS机制;

支持event MPM;

支持异步读写;

支持每模块及每个目录分别使用各自的日志级别;

每请求配置;<If>

增强版的表达式分析器;

支持毫秒级的keepalive timeout;

基于FQDN的虚拟主机不再需要NameVirtualHost指令;

支持用户自定义变量;

新模块:

mod_proxy_fcgi:与PHP结合的模块;

mod_ratelimit:限制下载速率的模块;

mod_remoteip:设定远程客户端IP;

修改的配置机制:不再支持使用order,allow,deny定义基于ip的访问控制,改为require;

编译安装Httpd2.4:

httpd2.4依赖于apr和apr-util,1.4以上版本,所以需要一同编译安装;

apr:ApachePortable Runtime,Apache可移植运行时;

官网:apr.apache.org

实验环境:

系统版本:CentOS 6.6x86_64;

httpd源码包:httpd-2.4.16.tar.bz2;

apr源码包:apr-1.5.2.tar.bz2;

apr-util源码包:apr-util-1.5.4.tar.bz2

实验前提:

关闭防火墙和SELinux;

安装编译环境;

# yum groupinstall "Server Platform Development" "Developmenttools"

实验过程:

一、安装服务;

apr:

# tar xf apr-1.5.2.tar.bz2
# cd apr-1.5.2
#./configure --prefix=/usr/local/apr
# make && make install

apr-util:

# tar xf apr-util-1.5.4.tar.bz2
# cd apr-util-1.5.4
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/--with-apr=/usr/local/apr/    :指明apr安装位置;
# make && make install

httpd:

# tar xf httpd-2.4.16.tar.bz2
# cd httpd-2.4.16
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --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=all --enable-mpms-shared=all --with-mpm=event
# make && make install

httpd编译参数解释:

--prefix=/usr/local/apache    :安装位置;
--sysconfdir=/etc/httpd    :配置文件位置;
--enable-so    :支持DSO动态装载模块;
--enable-ssl    :支持SSL/TLS,可实现https协议访问,需要安装openssl-devel;
--enable-cgi    :支持CGI脚本;
--enable-rewrite    :支持URL重写;
--with-zlib    :使用指定的zlib压缩库,不指定路径会自动寻找;
--with-pcre    :使用指定的pcre库,增强的正则表达式分析工具;不指定路径会自动寻找 需已安装pcre-devel;
--with-apr=/usr/local/apr    :指定依赖apr程序安装位置;
--with-apr-util=/usr/local/apr-util    :指定依赖apr-util程序安装位置;
--enable-modules=all    :支持动态启用模块;all:所有,most:常用;
--enable-mpms-shared=all    :编译并共享模块;
--with-mpm=event    :默认启用模块;{prefork|worker|event}

二、参数配置;

接下来是安装完成之后的参数配置;

添加环境变量,并重读文件:

# vim /etc/profile.d/httpd.sh
> export PATH=/usr/local/apache/bin:$PATH
# source /etc/profile.d/httpd.sh

导出头文件;

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

导出man手册;

# vim /etc/man.config
> MANPATH /usr/local/apache/man

启动服务,查看监听端口;

# apachectl start
# ss �tnl

访问测试;

提供服务脚本:

可使用rpm包安装提供的脚本修改使用:

# vim /etc/rc.d/init.d/httpd
> #!/bin/bash
> #
> # httpdStartup script for the Apache HTTP Server
> #
> # chkconfig:- 85 15
> #description: Apache is a World Wide Web server. It is used to serve \
> #        HTML files and CGI.
> #processname: httpd
> # config:/etc/httpd/conf/httpd.conf
> # config:/etc/sysconfig/httpd
> # pidfile:/var/run/httpd.pid
>
> # Sourcefunction library.
> ./etc/rc.d/init.d/functions
>
> if [ -f/etc/sysconfig/httpd ]; then
>     . /etc/sysconfig/httpd
> fi
>
> # Starthttpd in the C locale by default.
> HTTPD_LANG=${HTTPD_LANG-"C"}
>
> # This willprevent initlog from swallowing up a pass-phrase prompt if
> # mod_sslneeds a pass-phrase from the user.
> INITLOG_ARGS=""
>
> # SetHTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
> # with thethread-based "worker" MPM; BE WARNED that some modules may not
> # workcorrectly with a thread-based MPM; notably PHP will refuse to start.
>
> # Path tothe apachectl script, server binary, and short-form for messages.
> apachectl=/usr/local/apache/bin/apachectl
> httpd=${HTTPD-/usr/local/apache/bin/httpd}
> prog=httpd
> pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}
> lockfile=${LOCKFILE-/var/lock/subsys/httpd}
> RETVAL=0
>
> start() {
>     echo -n $"Starting $prog: "
>     LANG=$HTTPD_LANG daemon --pidfile=${pidfile}$httpd $OPTIONS
>     RETVAL=$?
>     echo
>     [ $RETVAL = 0 ] && touch${lockfile}
>     return $RETVAL
> }
> stop() {
>     echo -n $"Stopping $prog: "
>     killproc -p ${pidfile} -d 10 $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=$?
>     echo $"not reloading dueto configuration syntax err or"
>     failure $"not reloading$httpd due to configuration >syntax error"
>     else
>     killproc -p ${pidfile} $httpd-HUP
>     RETVAL=$?
>     fi
>     echo
> }
>
> # See how wewere called.
> case"$1" in
> start)
>     start
> ;;
> stop)
>     stop
> ;;
> status)
>     status -p ${pidfile} $httpd
>     RETVAL=$?
> ;;
> restart)
>     stop
>     start
> ;;
> condrestart)
>     if [ -f ${pidfile} ] ; then
>     stop
>     start
>     fi
> ;;
> reload)
>     reload
> ;;
> graceful|help|configtest|fullstatus)
>     $apachectl $@
>     RETVAL=$?
> ;;
> *)
> echo $"Usage: $prog{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
> exit 1
> esac
>
> exit $RETVAL

修改主配置文件指定pidfile;

# vim /etc/httpd/httpd.conf
> PidFile "/var/run/httpd.pid"

脚本执行权限;

# chmod +x /etc/rc.d/init.d/httpd

添加服务,测试脚本;

# chkconfig httpd �add
# chkconfig httpd on
# service httpd stop
# service httpd start
# service httpd restart
# service httpd reload

httpd2.4配置文件:

# /etc/httpd24    :编译安装时指定的配置文件目录;
# /etc/httpd24/httpd.conf    :主配置文件
# /etc/httpd24/extra/httpd-default.conf    :默认配置文件,keepalive、AccessFileName等设置;
# /etc/httpd24/extra/httpd-userdir.conf    :用户目录配置文件;
# /etc/httpd24/extra/httpd-mpm.conf    :MPM配置文件;
# /etc/httpd24/extra/httpd-ssl.conf    :SSL配置文件,为站点提供https协议;
# /etc/httpd24/extra/httpd-vhosts.conf    :虚拟主机配置文件;
# /etc/httpd24/extra/httpd-info.conf    :server-status页面配置文件;

至此httpd2.4的编译安装配置已完成,httpd2.4的配置与httpd2.2大致相同。

本文出自 “小马的学习记录” 博客,请务必保留此出处http://masachencer.blog.51cto.com/8683770/1682809

转载于:https://my.oschina.net/masachencer/blog/540875

Httpd2.4简介及CenOS6.6下编译安装相关推荐

  1. linux php7.2编译安装,Linux下编译安装php7.2

    准备工作 所有操作需要在root用户下 安装路径: /usr/local/php 安装PHP 首先要安装如下依赖包 $ yum install -y gcc gcc-c++  make zlib zl ...

  2. Ubuntu16下编译安装Open Babel2.4.1和python绑定

    上一篇介绍的是CentOS 7下编译安装Open Babel2.4.1和python绑定点击打开链接 一.Open Babel简介 Open Babel是一款开源自由软件,使用Open Babel可以 ...

  3. linux 保存编译log,(转)Linux下编译安装log4cxx

    一个项目的服务器端在Linux平台下,用到了开源日志库log4cxx,这个库是apache项目的一个子库.功能很不错.下面记录下它的编译和安装过程. 第一步安装apr-1.3.8,顺序不能错,它必须首 ...

  4. linux下编译httpd,Linux下编译安装Apache httpd 2.4

    Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一.当前Apache版本为2.4,本文主要描 ...

  5. linux3.10.53编译,根据官方文档在Linux下编译安装Apache

    根据官方文档在Linux下编译安装Apache 前言 永远记住官方文档才是最准确的安装手册,这篇文章仅为对官方文档的解读和补充,学习提升务必阅读官方文档: http://httpd.apache.or ...

  6. linux mysql 5.6.22_LinuxCentOS6.0下编译安装MySQL5.6.22

    Linux CentOS6.5下编译安装MySQL 5.6.22[给力详细教程] 一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库(安装过程注意有没出错) yum install gcc ...

  7. 在Ubuntu下编译安装atom编辑器

    2019独角兽企业重金招聘Python工程师标准>>> 今天一大早就在开源中国首页看到了atom编辑器可以下载使用的消息,打开一看只提供Mac版的安装包.于是去Github上看了看, ...

  8. CentOS 6下编译安装Nginx

    CentOS 6下编译安装Nginx  By:老宁 一.准备make环境  yum -y install gcc gcc-c++ automake autoconf libtool make 二.准备 ...

  9. debian编译mysql_MySQL数据库之Debian 6.02下编译安装 MySQL 5.5的方法

    本文主要向大家介绍了MySQL数据库之Debian 6.02下编译安装 MySQL 5.5的方法 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助. 环境 : Debian 6.02 ...

最新文章

  1. Scanner方法中nextLine()和next()区别
  2. ubuntu,kali linux和windows三系统流水账——写给自己
  3. ubuntu上最使用jni最简单易懂的例子
  4. 解析底层原理!Android开发者面试如何系统复习?帮你突破瓶颈
  5. List和Set集合使用
  6. Excel和PPT已经落后了,可视化大屏强在哪?一次看过瘾
  7. scheduled 每月最后一天_单周、双周、每月?哪种定投方式收益最高?
  8. [UWP开发]NavigationView基础使用方法
  9. cnm的下载频道,再c一次。
  10. JQuery版本下载链接
  11. deepin删除应用程序中图标
  12. cout 和printf的区别,输出不同
  13. 您需要administrator权限才能对此文件进行更改
  14. linux 下搭建portal服务器搭建,Linux环境下IBM WebSphere Portal v8.5独立服务器安装记录...
  15. Decision-making Strategy on Highway for Autonomous Vehicles using Deep Reinforcement Learning
  16. Windows实用工具推荐
  17. Linux更改本机ip
  18. ​当英雄链逞不了英雄 比特吴等代投们也身陷囹圄
  19. R 入门级 之 《R的基本原理与概念》 -- 200412
  20. Android上传文件

热门文章

  1. python和anaconda区别_Pycharm、Anaconda到底是什么?有什么区别?
  2. java mysql大小写_MySQL大小写敏感的解决方案
  3. python爬虫语言都能干什么_python除了爬虫还可以做什么
  4. 进出仓原理_通达信浪口主图+窥窃天机副图+进出仓副图强强组合
  5. JAVA math.sin(X)画圆_关于Math.sin(),Math.cos()画圆
  6. 洛克菲勒的38封信pdf下载_《洛克菲勒写给孩子的38封信》读书笔记
  7. DQL 学习4-- Using DQL
  8. Java 之 Annotation(注解)介绍
  9. mysql 5.6 外键_mysql 5.6外键约束错误;没有发生在5.5
  10. Python中的for in if 用法