个人试验成功-Ubuntu14.04下安装httpd

本文详细介绍如何从源码安装配置HTTP服务器,包括下载http、apr-util、apr及pcre源码并进行编译安装,以及解决libpcre.so.1缺失问题。

准备工作:

1.下载http源码

2.下载apr-util源码

3.下载apr源码

4.下载pcre源码

5.讲上述4个源码包都放到 /home/hhc(你的用户名)/Downloads 下

6.运行下面的脚本

cd /home/hhc/Downloads/

# APR and APR-Util
# Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/) and use ./configure's --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

gzip -d /home/hhc/Downloads/httpd-2.4.4.tar.gz
tar xvf /home/hhc/Downloads/httpd-2.4.4.tar
mv -f /home/hhc/Downloads/httpd-2.4.4 /usr/local

gzip -d /home/hhc/Downloads/apr-1.4.8.tar.gz
tar xvf /home/hhc/Downloads/apr-1.4.8.tar
mv apr-1.4.8 apr
mv -f /home/hhc/Downloads/apr /usr/local/httpd-2.4.4/srclib/

gzip -d /home/hhc/Downloads/apr-util-1.5.3.tar.gz
tar xvf /home/hhc/Downloads/apr-util-1.5.3.tar
mv apr-util-1.5.3 apr-util
mv -f /home/hhc/Downloads/apr-util /usr/local/httpd-2.4.4/srclib/

# Perl-Compatible Regular Expressions Library (PCRE)
# This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package. If your build system can't find the pcre-config script installed by the PCRE build, point to it using the --with-pcre parameter. On some platforms, you may have to install the corresponding -dev package to allow httpd to build against your installed copy of PCRE.
gzip -d /home/hhc/Downloads/pcre-8.34.tar.bz2
tar xvf /home/hhc/Downloads/pcre-8.34.tar
cd pcre-8.34
./configure
make
make install

cd /usr/local/httpd-2.4.4
./configure --with-included-apr
make
make install

7.安装好后按照官网教程运行

bin/apachectl -k start

8.此时可能有问题:

httpd error while loading shared libraries: libpcre.so.1

是因为找不到libpcre.so.1,但是在前面我们已经安装了这个东西,网上nignx安装报同样问题的解决方法不适用于httpd,正确方法是

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

或者在/etc/profile文件中加入上面一行语句,然后运行

source /etc/profile

生效后,再启动httpd:

bin/apachectl -k start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值