Comments on How to Enable HTTP/2 in Apache Web Server on Ubuntu and Debian

Hypertext Transfer Protocol Version 2 (HTTP/2) is the latest version of the HTTP protocol. This tutorial shows you how to enable HTTP/2 in Apache web server on Debian and Ubuntu.

8 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Daniel

Important information missing. The default MPM prefork module is not sufficient and will lead to error message:

"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."

One needs to install an MPM like mpm_event that is multithreaded. And this again causes mod_php to not work safely anymore, as it is not thread-safe. So if you run PHP, and most people will do, you need to run PHP through php-fpm and that means having another additinal daemon running on the server.

All of this is no big issue, but needs to be mentioned or people will be misled.

By: Onion Geex

This is exactly what i am facing! Great Work Daniel!

By: Onion Geex

I finally found definitve solution. (refer https://http2.pro/doc/Apache )

Here is direct Ctrl+C and Ctrl+V | I am lazy ;) |

Apache 2.4.27, HTTP/2 not supported in prefork

Starting from Apache 2.4.27, the Apache MPM (Multi-Processing Module) prefork no longer supports HTTP/2. This will be indicated in your Apache error log as follows:

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.

To fix this, select a different MPM: event or worker. We highly recommend you to use the event prefork. If you are using PHP, it is likely that PHP is integrated to Apache via the mod_php module, which requires the prefork MPM. If you switch out from preform MPM, you will need to use PHP as FastCGI. To switch to php-fpm, you can do as folllwing. Please note that this assumes you have PHP installed from ondrej/php repository on Ubuntu. The PHP package names could be different in other repositories. Change package name and apt-get commands to match your PHP vendor and package manager. 

apachectl stop apt-get install php7.1-fpm # Install the php-fpm from your PHP repository. This package name depends on the vendor. a2enmod proxy_fcgi setenvif a2enconf php7.1-fpm # Again, this depends on your PHP vendor. a2dismod php7.1 # This disables mod_php. a2dismod mpm_prefork # This disables the prefork MPM. Only one MPM can run at a time. a2enmod mpm_event # Enable event MPM. You could also enable mpm_worker. apachectl start HTTP/2 not enabled on older TLS versions

Mozilla Firefox (among other browsers) does not enable HTTP/2 protocol unless the connection is made over TLS 1.2 and using modern cipher suits. This is not a technical limitation, but rather a safety precaution. Make sure your that your site supports TLS 1.2, and modern cipher suits with AES/CHACHA20 with forward-secrecy key exchanges. In turn, Apache does not try to establish an HTTP/2 connection with connections over older cipher configurations either. you can force Apache attempt HTTP/2 upgrade with the following directive, but it will not be as effective because browsers do not support HTTP/2 from their end anyway.

H2ModernTLSOnly off

By: Jamseer

Could not change  HTTP/1.1  to HTTP/2.0 

By: ArsN

Hello! I folowed this tutorial to enable http2 on my website , however if I check with online tools it still says I am not using http2 ? I restarted apache2 after configuring everything. Any ideas?

By: Antonio

What happen if a browser force to get a http/1.1 request in a http/2 server? The webpage will not be display. What is the solution?

By: agentmoller001

Adding the Protocols to the apache2.conf solves your question.

Protocols h2 http/1.1

By: patfoo

this tutorial worked for me on debian 10 using ispconfig control panel Version: 3.1.15p3.I did not edit the vhost file or other apache2 config file.I did enable spdy/http2 in the ispconfig admin panel unde Server Config>Web>SSL Makes SPDY/HTTP2 available check. And then enable in the website at the bottom of the ssl tab (in the client dashboard in my case).I rebooted the server and then it worked.