Apache HTTP/2

In Apache, you may wish to enable the HTTP/2 so that the website content can load faster on the request. For this to work you would need Apache to be installed and the HTTP/2 module to be enabled.

root@mysuperweb:/var/www/html# a2enmod http2
Enabling module http2.
To activate the new configuration, you need to run:
  systemctl restart apache2

The above code will enable the HTTP/2 on the Apache, naturally you would need to restart Apache for the changes to take affect. At the same time you also need to make changes to the Apache configuration.

<VirtualHost *:443>
      Protocols h2 http/1.1

Even with the correct configuration, the HTTP/2 may still not load up, the error logs may show the following message at:


[Thu Jul 19 11:36:00.013581 2018] [http2:warn] [pid 26193] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.

The issue is where by the default mpm (multi-processing module) in Apache is mpm_prefork, this doesn’t work with Apache as of version 2.4.27, this means that you would use another mpm such as mpm_event or mpm_worker.

The differences between the three types of mpm can be shown below:

prefork - Implements a non-threaded, pre-forking web server.

worker - Multi-Processing Module implementing a hybrid multi-threaded multi-process web server.

event - A variant of the worker MPM with the goal of consuming threads only for connections with active processing.

You can verify your mpm on the configuration with:

root@mysuperweb:~# apachectl -V
Server version: Apache/2.4.25
Server built:   2018-06-02T08:01:13
Server's Module Magic Number: 20120211:68
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)