简体   繁体   English

如何在centos7上启用http2

[英]how to enable http2 on centos7

I have CENTOS7 server, with: 我有CENTOS7服务器,有:

Server version: Apache/2.4.6 (CentOS) 服务器版本: Apache / 2.4.6 (CentOS)

. How can i enable/add HTTP/2 on these Apache ? 如何在这些Apache上启用/添加HTTP / 2? I'm trying to send http2 requests from the client via Nghttp, but i get an error in the response (recv RST_STREAM frame ) as a result of server which does not supports Http2. 我正在尝试通过Nghttp从客户端发送http2请求,但由于不支持Http2的服务器,我在响应(recv RST_STREAM帧)中收到错误。

I saw that i have to enable module_http2 in the apache, but i didn't found hot can i do this. 我看到我必须在apache中启用module_http2,但我没有发现我可以做到这一点。

Thanks in Advance. 提前致谢。

HTTP/2 support was only added in Apache 2.4.18 which is not available in the standard CentOS/Red Hat repos. HTTP / 2支持仅在Apache 2.4.18中添加,这在标准的CentOS / Red Hat存储库中不可用。 Though as mod_http2 was (and still is at time of writing) being actively worked on you should go with the latest version (2.4.33 at time of writing - though there are further mod_http2 patches available on top of that). 虽然作为mod_http2(并且仍处于编写时)正在积极开展工作,但您应该使用最新版本(编写本文时为2.4.33 - 尽管还有更多的mod_http2补丁)。

Additionally HTTP/2 requires OpenSSL 1.0.2 or above which means you need CentOS/RHEL 7.4 or above unless you want to install your own version of OpenSSL as well your own version of Apache. 此外,HTTP / 2需要OpenSSL 1.0.2或更高版本,这意味着您需要CentOS / RHEL 7.4或更高版本,除非您想要安装自己的OpenSSL版本以及您自己的Apache版本。 Note you need Apache 2.4.26 or above if you want to go further than that and go to OpenSSL 1.1.0. 请注意,如果您想要更进一步,请转到OpenSSL 1.1.0,需要Apache 2.4.26或更高版本。

So you need to download and compile a later Apache (and possibly OpenSSL) from source - or find another repo with these later versions. 因此,您需要从源代码下载并编译更高版本的Apache(可能还有OpenSSL),或者找到这些更高版本的另一个repo。 This does carry some risks - primarily that you lose the easy security patches that repo versions supply. 这确实存在一些风险 - 主要是因为您丢失了repo版本提供的简单安全补丁。 CentOS Apache 2.4.6 actually includes all the latest security patches of later versions (assuming you regularly run "yum update" to update it) - but not the functionality changes like HTTP/2 (hence why they leave version number at 2.4.6). CentOS Apache 2.4.6实际上包含了更新版本的所有最新安全补丁(假设您经常运行“yum update”来更新它) - 但不是像HTTP / 2那样的功能更改(因此它们为什么将版本号保留为2.4.6) 。

If you're interested in installing from source then I've a step by step blog post on how to do that here: https://www.tunetheweb.com/performance/http2/ 如果您对从源代码安装感兴趣,那么我将在此处逐步介绍如何执行此操作: https//www.tunetheweb.com/performance/http2/

You can install a newer version of httpd than is included in the base repositories through the httpd24 Software Collection . 您可以通过httpd24软件集安装较新版本的httpd,而不是基本存储库中包含的版本。 Once you've enabled the SCL, you need the following packages: 启用S​​CL后,您需要以下软件包:

  • httpd24 httpd24
  • httpd24-nghttp2 httpd24-nghttp2
  • httpd24-mod_ssl * httpd24-mod_ssl *

* It's best to configure SSL too, because for example Chrome will only do HTTP2 with TLS. *最好也配置SSL,因为例如Chrome只会使用TLS执行HTTP2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM