Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable http2 on centos7

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.

like image 804
Adam Avatar asked Nov 21 '16 12:11

Adam


People also ask

How do I enable http2 protocol?

Enable HTTP/2 on a Apache Virtual Host You can do this on a browser by opening the developer tools section on Google chrome using the Ctrl +SHIFT + I combination. Click on the 'Network' tab and locate the 'Protocol' column. Next, enable the HTTP/2 module on Ubuntu by running the following command.

How do I enable http2 in Chrome?

Go to the chrome://flags page (I can't link to it directly, as the browser won't allow direct links to the settings page) in your Chrome browser. Search for HTTP/2. Find the option called Enable SPDY/4. Next, restart Chrome and SPDY4 will be enabled.

How do I enable http2 in WHM?

Enable HTTP2 via WHM: Log in to WHM and go to Home >> Software >> EasyApache 4 >> Customize >> Apache modules, disable the mod_mpm_prefork if it is enabled, click on 'review' to review the changes and click on 'Provision'. Click on 'Next' , and click on 'Provision' to install and enable the 'mod_http2' Apache module.

What is mod_http2?

Module: mod_http2. This directive toggles the usage of the HTTP/2 Direct Mode. This should be used inside a <VirtualHost> section to enable direct HTTP/2 communication for that virtual host.


1 Answers

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/

like image 50
Barry Pollard Avatar answered Sep 29 '22 09:09

Barry Pollard