Enabling HTTP/2 on Apache2

HTTP/2 brought multiplexing, header compression, and server push to the web — meaningfully faster page loads for sites with many resources, and Apache has supported it for years via mod_http2.

sudo a2enmod http2
<VirtualHost *:443>
    ServerName example.com
    Protocols h2 http/1.1

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
curl -I --http2 https://example.com
# Look for "HTTP/2 200" in the response

HTTP/2 Requires HTTPS in Practice

While the HTTP/2 spec technically allows unencrypted connections, every major browser only supports it over HTTPS — meaning HTTP/2 is effectively another good reason (alongside security) to have SSL properly configured, not an optional add-on separate from it.