Languages
[Edit]
EN

apache2 - http2 / h2 protocol configuration

9 points
Created by:
Bess
571

In this short article, we would like show how to configure http2 protocol (called h2 over TSL) for Apache 2.4 server.

Read all sectons to know how to enable http2 / h2 protocol.

1. Software

Edit

During configuration, the following software were used (treat it only as recommendation):

  1. Windows 10,
  2. Apache 2.4.39 installed as WampServer x64 (download link here),
  3. PHP 7.3.5 (is installed automatically with WampServer, we need to select it with context menu only).
Switching to PHP 7.3.5 in WampServer
Switching to PHP 7.3.5 in WampServer

2. HTTPS configuration

Edit

http2 / h2 protocol requires HTTPS protocol. Go to this article to see how to configure it.

3. Enabling Apache 2.4 modules

Edit

In this case we need to enable only one module: http2_module.

We can do it in 2 ways:

  • from context menu: Apache -> Apache modules -> http2_module
  • from configuration file c:\wamp64\bin\apache\apache2.4.39\conf\httpd.conf by uncommenting following line:

4. Setting Apache 2.4 configurations

Edit

It is necessary to add inside VirtualHost which provides HTTPS connection only one line that enables http2 / h2 protocol:

In my case c:\wamp64\bin\apache\apache2.4.39\conf\extra\httpd-vhosts.conf file as last configuration contains following VirtualHost:

Note: you can use Protocols h2 h2c http/1.1 if you want to enable HTTP/2 over TCP too - read more here.

5. Server restart

Edit

Most simple is to click Restart All Services item in WampServer context menu located in Windows try bar.

6. Verify HTTP2 / h2 connection

Edit

Use Google Chrome DevTools to check if http2 is enabled.

Note: to see how to verify http2 with openssl read this article.

apache 2 with enabled http2 / h2 protocol
apache 2 with enabled http2 / h2 protocol

Note: use right mouse button to display Protocol column. 

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Apache2

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join