How to install HTTP/2 in Apache2 and Debian 10

In this post I will explain you how to install HTTP/2 in Apache2 and Debian 10.

You will need:

To check the Apache 2 version:

$ sudo apache2 -v
Server version: Apache/2.4.38 (Debian)

To check if the SSL module is enabled:

$ sudo apachectl -M | grep ssl
ssl_module (shared)

If you have not SSL installed, execute:

$ sudo a2enmod ssl

Disable the mod_php module (I suppose you are using PHP-FPM). Do this for each PHP version you have installed:

$ sudo a2dismod php8.0 

Disable Apache MPM Prefork and enable Apache MPM event:

$ sudo a2dismod mpm_prefork 
$ sudo a2enmod mpm_event

Enable the HTTP/2 Apache module:

$ sudo a2enmod http2

Check that the Apache2 modules are enabled:

$ sudo apache2ctl -M | grep 'ssl\|http2'
http2_module (shared)
ssl_module (shared)

Enable the HTTP/2 protocol in the Apache2 configuration, adding the next line to the /etc/apache2/apache2.conf file:

Protocols h2 http/1.1

Restart the Apache2 service:

$ sudo systemctl restart apache2

And then test if the HTTP/2 protocol is enabled in one website in this server with some online services like HTTP2.Pro or KeyCDN tools.

3 comments

  1. Thank you Jesús.
    For my configuration i have to keep mpm_event active.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.