How to enable HTTP2 in Apache 2.4 (Ubuntu)


Make sure you have PHP 7.0 or higher with FPM (FastCGI). I will not cover how to do this here.

Change MPM from "prefork" to "event"

(Assuming you're already have the PHP correctly setup)

1. Find out if what MPM configuration you're using

apachectl -V | grep -i mpm

2. Apache official guide explains in more detail why MPM Prefork will not work with HTTP2.

Disable MPM Prefork:

a2dismod mpm_prefork

Enable MPM Event:

a2enmod mpm_event

Restart Apache (command might vary in each setup):

/etc/init.d/apache2 restart

Tell your site's VHOST to use HTTP2

The Virtual Host file of your site should be configured to something like:

Protocols h2 h2c http/1.1

Make sure you have the HTTP2 module enabled

a2enmod http2

Done 🎉

You should be now set. Open the Chrome DevTools and verify the protocol of the network calls when loading your site.

No joy?

Here's another guide for you. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *