how to enable http2 on centos7
Asked Answered
A

2

14

I have CENTOS7 server, with:

Server version: Apache/2.4.6 (CentOS)

. How can i enable/add HTTP/2 on these Apache ? 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.

I saw that i have to enable module_http2 in the apache, but i didn't found hot can i do this.

Thanks in Advance.

Axenic answered 21/11, 2016 at 12:53 Comment(2)
You need to build it from source adding the following flag --enable-http2Ayers
I have the same problem, Is there any solutions?Ironhanded
L
14

HTTP/2 support was only added in Apache 2.4.18 which is not available in the standard CentOS/Red Hat repos. 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).

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. Note you need Apache 2.4.26 or above if you want to go further than that and go to OpenSSL 1.1.0.

So you need to download and compile a later Apache (and possibly OpenSSL) from source - or find another repo with these later versions. This does carry some risks - primarily that you lose the easy security patches that repo versions supply. 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).

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/

Lanielanier answered 21/11, 2016 at 19:41 Comment(0)
L
1

You can install a newer version of httpd than is included in the base repositories through the httpd24 Software Collection. Once you've enabled the SCL, you need the following packages:

  • httpd24
  • httpd24-nghttp2
  • httpd24-mod_ssl *

* It's best to configure SSL too, because for example Chrome will only do HTTP2 with TLS.

Larisa answered 25/2, 2018 at 14:37 Comment(2)
How do you enable the module? I installed the packets but cannot enable them... Cannot load modules/mod_http2.so into server: libnghttp2-httpd24.so.14: cannot open shared object file: No such file or directoryVitavitaceous
I think this answer is incorrect. In Centos/RHEL 7, httpd24-nghttp2 doesn't include the Apache module, just the nghttp2 library.Thallic

© 2022 - 2024 — McMap. All rights reserved.