3

System Information:

Ubuntu 16.04

Apache 2.4.29

PHP 7.0.22 (CLI)

In order to enable Apache 2 I have followed the followed the steps within this tutorial: https://http2.pro/doc/Apache.

Including:

Added Protocols h2 h2c http/1.1 to apache2.conf as well as to the Virtual Hosts configuration.

Successfully did:

a2enmod mpm_event
a2enmod http2 

Restarted:

service apache2 restart
sudo service php7.0-fpm reload

Still the server refuses to talk HTTP 2. Tried various tutorials.

I am fairly new to Ubuntu: What may I be missing and which steps can I take to debug this issue?

Blackbam
  • 147

1 Answers1

3

Problem

Browsing the /var/log/apache2/error.log archive, contains something like this:

[http2:warn] [pid 3220] AH10034: The mpm modum 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 will be inactive.

Prerequisits

Run at terminal command for get your own variables:

  • Ubuntu version: lsb_release -a
  • Apache version: apache2 -v
  • PHP version : php -v

This question is for:

Ubuntu 16.04
Apache 2.4.29
PHP 7.0.22 (CLI)

This answer is exactly for:

Ubuntu 16.04.3 LTS
Apache/2.4.29 (Ubuntu)
PHP 7.1.12-3+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Dec 14 2017 15:37:13)

The PHP 7.1.12 was built following the steps given at (see question): How to enable HTTP/2 support in Apache, last updated 5 nov 2017.


Disclaimer

Do it at your own risk; do not use this anwser on any production server. You are welcome ;-) .


Answer

Cite, same tutorial named before:

Apache 2.4.27, HTTP/2 not supported in prefork

We must change mode prefork to mode event or worker, but WARNING you will need to use PHP as FastCGI.

Step by step

Step one

First add Ondřej Surý's repository (please note UTF8 characters) to your Ubuntu, this instructions are taken from this DigitalOcean's tutorial. You will need root rights, here we will use sudo command:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update

Step two

sudo apt-get install php7.1

Yeah, right, no kidding. After that, next step.

Step three

sudo apachectl stop
sudo apt-get install php7.1-fpm 
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.1-fpm 
sudo a2dismod php7.1 
sudo a2dismod mpm_prefork 
sudo a2enmod mpm_event 
sudo apachectl start

Troubleshotting

If you have some problem with

sudo a2dismod php7.1

just try this:

sudo a2dismod php7.0

(we had this problem too: sudo a2dismod php7.1 )

Possible improvement

If you want use the latest pack:

sudo apt-get install php7.2-fpm

(We installed it, see the picture)

Verifying a well done job

See the next picture for our result and visit https://http2.pro for your own test (set ufw first!)

HTTP2.Pro check

Conclusion

A very new technology is comming! See other future protocols here!

Thanks for visit AskUbuntu!