编译安装apache

 
1、安装apr之前需要的的几个环境
      1、autoconf      :安装:yum install autoconf
       2、libtool          安装:yum install libtool
       3、C的编译器  安装:yum install gcc

yum install wget make gcc gcc-c++ pcre openssl openssl-devel zlib unzip cmake ncurses-devel libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel curl-devel libtool libtool-ltdl libtool-ltdl-devel libevent libevent-devel zlib-static zlib-devel autoconf pcre-devel gd perl freetype freetype-devel

./configure --prefix=/data2/apache/ par/  #安装地址  需要建立相应目录地址

make && make install

最后会在目录下 生成 apr 文件夹  

如果报错 No such file or directory  
vi configure
问题: $RM "$cfgfile"注释掉这行



2、安装apr-util 

 ./configure --prefix=/data2/apache/apr-util/  --with-apr=/data2/apache/apr/   #apr 的安装路径

make && make install

3 安装httpd            #  yum环境  yum -y install gcc gcc++ zlib zlib-devel


[root@Centos httpd-2.4.2]# cd httpd-2.4.12
[root@Centos httpd-2.4.2]# ./configure --prefix=/data2/apache/httpd-2.4.2/ --sysconfdir=/data2/apache/httpd-2.4.2/conf/ --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-deflate --with-z --with-pcre --with-apr=/data2/apache/apr/ --with-apr-util=/data2/apache/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event

# /data2/apache/httpd-2.4.2/conf/ 新建文件夹  配置文件 httpd.conf  文件存放地

[root@Centos httpd-2.4.12]# make && make install
# 各编译参数详解
--prefix:#安装路径
--sysconfdir:#指定配置文件路径
--enable-so:#DSO兼容,DSO=Dynamic Shared Object,动态共享对象,可实现模块动态生效
--enable-ssl:#支持SSL/TLS,可以实现https访问
--enable-cgi:#支持CGI脚本(默认对非线程的MPM模式开启)
--enable-rewrite:#启用Rewrite功能
--enable-deflate:#支持压缩
--with-z:#使用指定的zlib库,不指定路径会自动寻找
--with-pcre:#使用指定的PCRE库,不指定路径会自动寻找
--with-apr:#指定apr安装路径
--with-apr-util:#指定apr-util安装路径
--enable-modules:#支持动态启用的模块,可选参数有“all”,“most”,“few”,“reallyall”
--enable-mpms-shared:#支持动态加载的MPM模块,可选“all”
--enable--ssl    #支持ssl模块

4、 完成后  启动

/data2/apache/httpd-2.4.2/bin/apachectl restart  

访问ip加端口 出现 it works