记一次阿里云配置源码Apache

在阿里云上源码配置Apache,还是遇到很多问题。不过还好都是解决了,所以想写一篇博客来帮助大家配置Apache.

阿里云服务器配置 Centos 6.8

首先来看看阿里云官方配置Apache教程
这看起来很简单 但是其实有很多坑
首先先按官网的下载和解压Apache的源码包

这是我遇到的其中几个问题

  • checking for APR… no
    configure: error: APR not found. Please read the documentation.

  • checking for APR-util… no
    configure: error: APR-util not found. Please read the documentation.

  • configure: error: APR-util not found. Please read the documentation.
    checking for pcre-config… false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

  • checking for OpenSSL version >= 0.9.8a… FAILED configure: WARNING: OpenSSL version is too old no checking whether to enable mod_ssl… configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

所以要提前安装APR , APR-util, pcre, Openssl
首先下载这些包的源码

wget http://us.mirrors.quenda.co/apache//apr/apr-util-1.6.1.tar.gz
wget http://us.mirrors.quenda.co/apache//apr/apr-1.6.3.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1-pre8.tar.gz

APRAPR-util都是可以在Apache官网找到的 最好安装最新版本
Pcre最新源码包在这里
Openssl源码包在这里

安装这些源码包的步骤都是相似

tar -xvzf apr-1.6.3.tar.gz
tar -xvzf apr-util-1.6.1.tar.gz
tar -xvzf pcre-8.42.tar.gz
tar -xvzf openssl-1.1.1-pre8.tar.gz

这里注意,为了方便之后使用,请在/usr/local/目录下创建对应的文件夹 比如apr/和apr-util/和pcre/还有openssl/

然后在各自的文件夹中运行

./configure –prefix=/usr/local/当前你的目录名
make & make install

这里有个很坑的事情,在我安装Pcre的时候出现了这个错误

pcre Invalid C++ compiler or C++ compiler flags

后来才发现原来我服务器连g++都没有…..
而centos如果安装g++不可以用sudo yum install g++ 而要使用下面

sudo yum install gcc-c++

现在终于到了最后安装Apache的时候了,进入了httpd的目录

./configure –prefix=/usr/local/apache/httpd –enable-ssl=static –with-ssl=/usr/local/openssl –with-apr-util=/usr/local/apr-util –with-pcre=/usr/local/pcre

在阿里云官方给的命令中加入了3个with 然后成功编译.

configure: summary of build options:

    Server Version: 2.4.33
    Install prefix: /usr/local/apache/httpd
    C compiler:     gcc -std=gnu99
    CFLAGS:          -g -O2 -pthread
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE
    LDFLAGS:
    LIBS:
    C preprocessor: gcc -E

最后在运行

make & make install

运行httpd -v查看安装版本.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值