【问题标题】:How to enable apache-http/2 in centos 7?如何在 centos 7 中启用 apache-http/2?
【发布时间】:2018-02-12 08:50:51
【问题描述】:

我已按照以下链接在 centos-7 apache 中启用 http/2。 https://www.tunetheweb.com/performance/http2/

我的 openssl 版本:

# openssl version
OpenSSL 1.1.0f  25 May 2017

在安装最新的 apr-util 和 apache(httpd-2.4.27) 时 make 命令发生以下错误

在 apr-util 文件夹内:

# make

make[1]: Entering directory `/usr/local/src/apr-util-1.6.0'
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/src/apr-util-1.6.0/incl
ude -I/usr/local/src/apr-util-1.6.0/include/private  -I/usr/local/apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
 #include <expat.h>
                   ^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/usr/local/src/apr-util-1.6.0'
make: *** [all-recursive] Error 1

httpd 文件夹内:

#make

Making all in srclib
make[1]: Entering directory `/usr/local/src/httpd-2.4.27/srclib'
Making all in apr
make[2]: Entering directory `/usr/local/src/httpd-2.4.27/srclib/apr'
make[3]: Entering directory `/usr/local/src/httpd-2.4.27/srclib/apr'
make[3]: Nothing to be done for `local-all'.
make[3]: Leaving directory `/usr/local/src/httpd-2.4.27/srclib/apr'
make[2]: Leaving directory `/usr/local/src/httpd-2.4.27/srclib/apr'
Making all in apr-util
make[2]: Entering directory `/usr/local/src/httpd-2.4.27/srclib/apr-util'
make[3]: Entering directory `/usr/local/src/httpd-2.4.27/srclib/apr-util'
/bin/sh /usr/local/src/httpd-2.4.27/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/src/htt
pd-2.4.27/srclib/apr-util/include -I/usr/local/src/httpd-2.4.27/srclib/apr-util/include/private  -I/usr/local/src/httpd-2.4.27/srclib/apr/include    -o xml/apr_xml.lo -c xml/a
pr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
 #include <expat.h>
                   ^
compilation terminated.
make[3]: *** [xml/apr_xml.lo] Error 1
make[3]: Leaving directory `/usr/local/src/httpd-2.4.27/srclib/apr-util'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.4.27/srclib/apr-util'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.4.27/srclib'
make: *** [all-recursive] Error 1

【问题讨论】:

  • 运行 yum install expat-devel ,继续谷歌搜索哪个 CentOS 软件包包含其他失败的依赖项并安装它们。

标签: linux apache http2


【解决方案1】:

我建议从https://codeit.guru/en_US/2017/10/apache-httpd-2-4-28-built-against-openssl-1-0-2l-with-http2-for-red-hat-enterprise-linux-and-centos/ 安装即用包

或者,您可以从 Fedora 或 CodeIT 提供的 SRPM 重新编译它(与更改默认值和 openssl 路径的相同):

rpmbuild -ba ~/rpmbuild/SPECS/httpd.spec

【讨论】:

    【解决方案2】:

    @nos 是正确的,这需要yum install expat-devel 和我已经安装的一些其他依赖项。

    我现在更新了博客文章以反映这一点。如果您对此有任何其他问题,请随时与我联系。

    【讨论】:

      【解决方案3】:

      现在可以从codeit.guru 获得 CentOS 7 的 repo,它可以启用:

      cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo
      

      如果已经安装了 apache,yum update 会更新 apache,它甚至会启用 mod_http2
      否则,可以完成 apache 的全新安装。

      Protocols h2 http/1.1 放入ssl.conf 中作为Mozilla suggests
      重启apache,http/2就准备好了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-03-22
        • 2016-11-12
        • 2016-07-26
        • 2019-02-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多