2431 发表于 2016-2-22 08:32:15

Apache编译安装

同样apache也需要到官网下载合适的版本,目前使用较多的版本为2.0或者2.2阿铭建议下载2.2版本。apache官网下载地址: http://www.apache.org/dyn/closer.cgi

# cd /usr/local/src/
# wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.31.tar.gz
解压:
# tar zxvf httpd-2.2.16.tar.gz
配置编译参数:
# cd httpd-2.2.16
# ./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,后面的参数同理。如果这一步你出现了这样的错误:
error: mod_deflate has been requested but can not be built due to prerequisite failures

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

为了避免在make的时候出现错误,所以最好是提前先安装好一些库文件:
yum install -y pcre pcre-devel apr apr-devel


编译:
# make

安装:
# make install
启动:
/usr/local/apache2/bin/apachectl start

页: [1]
查看完整版本: Apache编译安装