qq70191 发表于 2018-11-19 08:45:56

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

  在安装或者升级成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下载文件,当然尽量使用最新的包
# links http://archive.apache.org/dist/apr/
# links http://jaist.dl.sourceforge.net/project/pcre/pcre/
#找一下最新的编译包
# wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.bz2
# wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.bz2
# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
# tar -jxf apr-1.5.2.tar.bz2 && tar -jxf apr-util-1.5.4.tar.bz2 && unzip pcre-8.10.zip
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make && make install
# cd ../apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
# make && make install
# cd ../pcre-8.10
# ./configure --prefix=/usr/local/pcre
# 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中:

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

2.4中:

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



页: [1]
查看完整版本: Apache2.4版本的安装或升级常见错误