一、编译安装apache2.4.9

1.前期准备

httpd-2.4.9需要较新版本的apr和apr-util,因此需要事先对其进行升级。升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包。这里选择使用编译源代码的方式进行。想服务器上传三个源代码包apr-1.5.0.tar.bz2  apr-util-1.5.3.tar.bz2  httpd-2.4.9.tar.bz2

2.安装apache细节

(1)编译安装apr

[root@student1 mnt]# tar xf apr-1.5.0.tar.bz2
[root@student1 mnt]# cd apr-1.5.0
[root@student1 apr-1.5.0]# ./configure --prefix=/usr/local/apr
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu

[root@student1 apr-1.5.0]# make && make install

 

(2)编译安装apr-until

[root@student1 mnt]# tar xf apr-util-1.5.3.tar.bz2
[root@student1 mnt]# cd apr-util-1.5.3
[root@student1 apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

[root@student1 apr-util-1.5.3]# make && make install

 

(3)编译安装apache2.4.9

httpd-2.4.9编译过程也要依赖于pcre-devel软件包,需要事先安装。此软件包系统光盘自带,使用yum本地源安装。

[root@student1 Packages]# yum install pcre-devel-7.8-6.el6.x86_64.rpm

之后开始安装apapche,执行如下配置

./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

 

遇到configure: WARNING: OpenSSL version is too old   no

checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

解决方法:使用yum安装新的openssl-devel就能解决,安装完毕后再次执行配置,顺利通过

 

[root@student1 httpd-2.4.9]# make && make install

顺利安装完毕

 

补充:

(1)构建MPM为静态模块
在全部平台中,MPM都可以构建为静态模块。在构建时选择一种MPM,链接到服务器中。如果要改变MPM,必须重新构建。为了使用指定的MPM,请在执行configure脚本 时,使用参数 --with-mpm=NAME。NAME是指定的MPM名称。编译完成后,可以使用 ./httpd -l 来确定选择的MPM。 此命令会列出编译到服务器程序中的所有模块,包括 MPM。

(2)构建 MPM 为动态模块

在Unix或类似平台中,MPM可以构建为动态模块,与其它动态模块一样在运行时加载。 构建 MPM 为动态模块允许通过修改LoadModule指令内容来改变MPM,而不用重新构建服务器程序。在执行configure脚本时,使用--enable-mpms-shared选项即可启用此特性。当给出的参数为all时,所有此平台支持的MPM模块都会被安装。还可以在参数中给出模块列表。默认MPM,可以自动选择或者在执行configure脚本时通过--with-mpm选项来指定,然后出现在生成的服务器配置文件中。编辑LoadModule指令内容可以选择不同的MPM。

二、制作Web的SSL证书

1.搭建一个私有的CA机构

部署基于apache2.4.9的https实验_服务器

部署基于apache2.4.9的https实验_服务器_02

2.web服务器创建证书并生产签署请求交给私建的CA

部署基于apache2.4.9的https实验_服务器_03

2.私建的CA给为签署请求签署,并发还给web服务器

部署基于apache2.4.9的https实验_服务器_04

三、Web服务器配置SSL模块功能

编辑httpd2.4.9的主配置文件加载两个模块

部署基于apache2.4.9的https实验_服务器_05

          部署基于apache2.4.9的https实验_源代码_06

          开启片段配置文件httpd-ssl.conf

          部署基于apache2.4.9的https实验_服务器_07

          接着就是编辑ssl.conf编辑情况,大致和apache2.2时候一样

      部署基于apache2.4.9的https实验_服务器_08

       部署基于apache2.4.9的https实验_服务器_09