skip to content

HTTP2 on Apache - Linux


To enable http2 support on Apache you need to load the following two modules:

  • SSL
  • HTTP/2

To do so, run the following commands in your terminal

sudo a2enmod ssl

And

sudo a2enmod http2

Then activate the new modules by restarting Apache

sudo systemctl restart apache2

After activating the Apache modules, navigate to the Apache directory and edit the configuration. Simply add the following line to your global Apache configuration or inside an individual virtual hos.

Protocols h2 http/1.1

Example

<VirtualHost *:443>

  ServerName triss.dev
  ServerAlias www.triss.dev
  DocumentRoot /var/www/public_html/triss.dev
  SSLEngine on
  SSLCertificateKeyFile /path/to/private.pem
  SSLCertificateFile /path/to/cert.pem
  SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1

  Protocols h2 http/1.1

</VirtualHost>