Apache,即httpd,是linux中常用的软件。下面我分享一下编译安装httpd 2.2的方法。


1. 下载源码

# cd /usr/local/src/ ##进入下载目录
# wget http://www.lishiming.net/data/p_w_upload/forum/httpd-2.2.24.tar.bz2 ## 64位源码包
# tar -jxvf httpd-2.2.24.tar.bz2


2. 配置编译参数:

    为防止后面的erro打断配置过程,可提前安装需要的包:

    erro: mod_deflate has been requested but can not be built due to rerequisitefailures(ubuntu centent)

    解决办法:yum install zlib-devel -y

# cd ./httpd-2.2.24
./configure \
--prefix=/usr/local/apache2 \ ## 指定的安装目录
--with-included-apr \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre

    注:--prefix: 指定安装路径;--enable-so:启动DSO;--enable-deflate=shared:动态共享方式编译deflate模块;


3. 确认无误后,编译和安装:

# make && make insatall