6

I have tried to enable http2 module on Apache/2.4.29 which I'm running on Ubuntu 16.04, but it seems that it doesn't work.

I did like this:

sudo a2enmod http2

And then active individually by adding:

Protocols h2 http/1.1

I'm also running mpm_prefork module, could that cause a problem for http2 and if yes what is alternative to run instead mpm_prefork?

One more thing I'm running shared server, which only allows PHP to run. I was checking for suPHP but it says on their website:

suPHP is not maintained any longer and will not receive any further updates not even security patches.

1
  • 2
    read conorb answer and mark it as valid, using prefork and http2 is a contradiction. – ezra-s Oct 23 '17 at 8:27
11

Here is a quick workaround that might help you out.

Also- there is some good data about mpm_prefork and workarounds under the troubleshooting section here

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.

1

I resolved, My case with PHP, Python, Django with Apache2 with direct / proxy use, I am unable to use http2. then figure out issue and resolve as below

apachectl stop
apt-get install php7.0-fpm # Install the php-fpm from your PHP repository. This package name depends on the vendor.
a2enmod proxy_fcgi setenvif
a2enconf php7.0-fpm # Again, this depends on your PHP vendor.
a2dismod php7.0 # 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

According your local you need right php version to setus, in my case its php7.0. In case you don't have PHP, just avoid php related step to follow.

Note: mpm_prefork does not well works with http2 and performance as well. my personal suggestion, use mpm_event or worker

As I setup above steps, I immediate got H2 Protocol. Your suggestion are most welcome in comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.