linux 安装httpd(验证通过)

一、安装apache(http服务)

1. 从apache.org下载源码安装包

2. 解压缩
# tar zxf httpd-2.2.4.tar.gz
# cd httpd-2.2.4

3. 安装apache依赖包apr和apr-util,他们都在srclib目录中

3.1 安装apr
# cd srclib/apr
# ./configure --prefix=/opt/httpd/apr && make && make install

3.2 安装apr-util
# cd ../apr-util
# ./configure --prefix=/opt/httpd/apr-util --with-apr=/opt/httpd/apr && make && make install

4.安装httpd
# cd ../../
# ./configure --prefix=/opt/httpd/httpd --with-apr=/opt/httpd/apr --with-apr-util=/opt/httpd/apr-util --enable-so --enable-modules=all --enable-mods-shared=all  --enable-rewrite && make && make install

--enable-so --enable-modules=all 

--enable-mods-shared=all
 

--enable-so 支持DSO模式(动态模块加载方式)
--enable-rewrite 支持rewrite(地址重定向)

等这些都装完后,打开浏览器,输入你安装apache所在的服务器地址,看起来像这个样子:
http://192.168.1.3/

如果页面显示如下:
It works!

恭喜你,apache安装成功了~

configure 错误提示:

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

  解决办法:

  zlib-devel 没装的原因

  yum install gcc zlib-devel openssl-devel(装这个package会有一堆关联包装上)

原文地址:https://www.cnblogs.com/quchengfeng/p/4790662.html