Question

HTTP2 not working on LAMP droplet with Ubuntu 20.04

Posted October 13, 2021 99 views
ApacheLAMP StackUbuntu 20.04

I followed the following steps to configure my LAMP droplet:

  1. Install LAMP with Ubuntu 20.04 - https://marketplace.digitalocean.com/apps/lamp
  2. Create non-root user: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04
  3. Create virtual host: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04 4: Install LetsEncrypt: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04
  4. Enable http2: https://http2.pro/doc/Apache

Enabling http2 should be straight forward by enabling it with the following command:
a2enmod http2

And adding this to the virtual host file:
Protocols h2 http/1.1

When I test my website(https://in-het-engels.com/) for http2 support on https://tools.keycdn.com/http2-test I get the following error:

  • HTTP/2 protocol is not supported.
  • ALPN extension is not supported.

Any ideas what I could try next to get it to work?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

I’ve just tested this and it seems to be working as expected:

Would you mind sharing here with the community how did you get this fixed?

Usually, if the configuration s done correctly, you would need to restart Apache after the change as well.
Best,
Bobby

  • Hi! Yes, let me explain how I fixed it.

    In my error log I had the following error: “The mpm module (prefork.c) is not supported by mod_http2.”

    This can be fixed by installing the php-fpm package.

    apachectl stop
    apt-get install php8.0-fpm # Change PHP version to your version
    a2enmod proxy_fcgi setenvif
    a2enconf php8.0-fpm # Change PHP version to your version
    a2dismod php8.0 # This disables mod_php. Change PHP version to your version
    a2dismod mpm_prefork # This disables the prefork MPM. In the following you will switch to php-fpm
    a2enmod mpm_event # Enable event MPM. 
    apachectl start
    

    I found the answer here: https://http2.co/how-to-fix-ah10034-the-mpm-module-prefork-c-is-not-supported-by-mod_http2/

    edited by bobbyiliev