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!

About Ricard Torres

Senior Front-end Software Engineer at Netcentric, from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> if you need to.