SDB:Apache HTTP 2 configuration

Jump to: navigation, search
You need to install Apache 2.4.0 or newer. For older openSUSE Leap systems, please download from OBS.
mod_php only works with prefork, so you have to switch to FactCGI + PHP-FPM.

How to

Install Apache2:

sudo zypper install apache2

Enable http2 mod:

sudo a2enmod http2

Enable HTTP2 flag:

sudo a2enflag HTTP2

Switch from prefork to event:

sudo zypper remove apache2-prefork
sudo zypper install apache2-event

For PHP websites, you have to switch from apache2-mod_php7 to php7-fpm.

As always, restart Apache:

sudo systemctl restart apache2

Explanation

Other OS will let you to modify *.conf files. However, openSUSE/SLE makes the solution simpler.

You can find a file

/etc/apache2/protocols.conf

which detects if apache2 has enabled http2 mod and been given HTTP2 flag. If both conditions are satisfied, Apache will enable HTTP/2 protocol.

Enabled mods and flags are stored in

/etc/sysconfig/apache2

You should avoid editing them directly. Use a2enmod/a2dismod and a2enflag/a2disflag commands instead.