How to Enable HTTP/2.0 Support on Apache Web Server

HTTP/2 is the first major HTTP protocol update since 1997 when HTTP/1.1 was first published by the IETF. HTTP/2 (originally named HTTP/2.0) is the second major version of the HTTP network protocol which was released by Internet Engineering Task Force (IETF) HTTP Working Group.

It’s based on SPDY, SPDY (pronounced speedy) is an open networking protocol developed by Google to serve web content with reducing web page load, latency and improving web security. This can be achieved through compression, multiplexing, and prioritization.

How to Enable HTTP/2.0 Support on Nginx Web Server

On February 17, 2015 HTTP/2 was approved and May 14, 2015 published. HTTP/2 was integrated with Apache 2.4.17 version by enabling mod_http2 module also Curl 7.43.0 added support for HTTP/2. Almost, all the web browser started supporting HTTP/2 such as Chrome, Opera, Firefox, Internet Explorer 11 & Safari. As of November 2015 2.3% of the top 10 million websites supported HTTP/2.

HTTP/2 will support HTTP & HTTPS but most of the browsers only support https with HTTP/2. If you want to avail advantages & performance benefits of HTTP/2 better migrate to HTTPS instead of HTTP

HTTP/2 Improvements

  • HTTP/2 is binary, instead of textual.
  • It is fully multiplexed, sending multiple requests in parallel over a single TCP connection.
  • It uses header compression HPACK to reduce overhead.
  • It allows servers to “push” responses proactively into client caches instead of waiting for a new request for each resource
  • It uses the new ALPN extension which allows for faster-encrypted connections since the application protocol is determined during the initial connection.
  • It reduces additional round trip times (RTT), making your website load faster without any optimization.
  • Domain sharding and asset concatination is no longer needed with HTTP/2.
  • For more details about HTTP2 improvements
  • For more details about HTTP2
  • http working group link

1) Add Apache 2.4.17 PPA for Ubuntu/Mint

Add the below PPA to install Apache 2.4.17 on Ubunt/LinuxMint older version systems. No need to add the PPA to latest version of Ubuntu & LinuxMint systems because by default official package available.

$ sudo add-apt-repository ppa:ondrej/apache2
$ sudo apt-get update
$ sudo apt-get install apache2

Check Apache2 version.

$ apache2 -v
Server version: Apache/2.4.17 (Ubuntu)

By default CentOS 7.x, Fedora 23, 24 & openSUSE 42.1 official package available for Apache 2.4.17. For other distributon, we need to install manually, Also we need to install mod_http2 module to RPM based system, which will enable automatically on apache while restarting.

2) Enable HTTP2 module

Use the below command to enable HTTP2 module in Apache.

[Enable HTTP2 module in Ubuntu/Debian/Mint System]
$ sudo a2enmod http2

[Install HTTP2 module in RHEL/CentOS/Fedora 21 and older Systems]
$ sudo yum install mod_http2

[Install HTTP2 module in Fedora 22 and later Systems]
$ sudo dnf install mod_http2

You may also like...