阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Apache2.4版本的安装或升级常见错误

148次阅读
没有评论

共计 3097 个字符,预计需要花费 8 分钟才能阅读完成。

在安装或者升级成 Apache2.4 版本时可能会一些错误,我们在实际生产环境中 Apache 是需要定制编译参数的,以实现生产环境的服务定制,但是用旧的编译参数时一般会报这样的错误,如下:

…略…
checking for APR… configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9
configure: WARNING: skipped APR at apr-1-config, version not acceptable
no
configure: error: APR not found.  Please read the documentation.

报这个错是因为我们原先在 Apache2.2 或者以下的版本中 Apache 依赖包 apr、apr-util、pcre 的版本使用 yum 或者是 apt-get 上的 rpm 包版本太低了,而 Apache2.4 中里这 3 种依赖包就需要用新的,在这里建议使用源码编译包安装,先用 links 看一下最新的包,当然用 links 也可以直接用 links 下载文件,当然尽量使用最新的包

[root@localhost src]# links http://archive.apache.org/dist/apr/
[root@localhost src]# links http://jaist.dl.sourceforge.net/project/pcre/pcre/
# 找一下最新的编译包
[root@localhost src]# wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.bz2
[root@localhost src]# wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.bz2
[root@localhost src]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
[root@localhost src]# tar -jxf apr-1.5.2.tar.bz2 && tar -jxf apr-util-1.5.4.tar.bz2 && unzip pcre-8.10.zip
[root@localhost src]# cd apr-1.5.2
[root@localhost apr-1.5.2]# ./configure –prefix=/usr/local/apr
[root@localhost apr-1.5.2]# make && make install
[root@localhost apr-1.5.2]# cd ../apr-util-1.5.4
[root@localhost apr-util-1.5.4]# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost apr-util-1.5.4]# make && make install
[root@localhost apr-util-1.5.4]# cd ../pcre-8.10
[root@localhost pcre-8.10]# ./configure –prefix=/usr/local/pcre
[root@localhost pcre-8.10]# make && make install

这样编译安装好 3 个最新的依赖包后,再在原来的 Apache 的编译参数后添加以下 3 条编译参数:

“–with-apr=/usr/local/apr” “–with-apr-util=/usr/local/apr-util/” “–with-pcre=/usr/local/pcre”

这样编译 Apache2.4 的版本的时候就不会报错了,除此之外 Apache 在 2.4 的版本后也做了大量的改动,比较常见的就是 Allow Deny Order 指令和以前是不一样了,如果还是用旧的配置文件会有 403 的错误,如下:

2.2 中:
AllowOverride all
RewriteEngine on
Order allow,deny
Allow from all
2.4 中:
AllowOverride all
RewriteEngine on
Require all granted
######################
2.2 中:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
2.4 中:
<Directory />
    AllowOverride none
    Require all denied
</Directory>

当然在 2.4 的版本中除了以上的一些改动修改了一些 bug 外,还有很多的改动,如果想知道更多可以参看官方的 document 文档 http://httpd.apache.org/docs/2.4/

下面关于 LAMP 相关 的内容你可能也喜欢

LAMP 平台安装 Xcache 和 Memcached 加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm

CentOS 7 下搭建 LAMP 平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5 系统安装配置 LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

CentOS 7.2 yum 安装 LAMP 环境  http://www.linuxidc.com/Linux/2016-11/136766.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP 结合 NFS 构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

CentOS7 下安装部署 LAMP 环境  http://www.linuxidc.com/Linux/2016-04/130653.htm

Ubuntu Server 14.04 LTS 下搭建 LAMP 环境图文详解  http://www.linuxidc.com/Linux/2016-12/138758.htm

Ubuntu Server 16.04 下配置 LAMP 环境 http://www.linuxidc.com/Linux/2016-12/138757.htm

Ubuntu 16.04 搭建 LAMP 开发环境 http://www.linuxidc.com/Linux/2016-10/136327.htm

Ubuntu 16.04 LTS 安装 Apache2+PHP7.0+MySQL+phpMyAdmin 图文详解  http://www.linuxidc.com/Linux/2017-02/140098.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-02/140254.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计3097字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中