googlelamp

Enable HTTP/2 support with Apache

Bitnami stacks ship with the mod_http2 module installed, but it is not enabled by default. To enable this module, follow these instructions. Once the module is active, follow the steps below:

  • Add the following lines in the default Apache HTTP virtual host configuration file at /opt/bitnami/apache/conf/bitnami/bitnami.conf, inside the default VirtualHost directive, so that it looks like this:

      <VirtualHost _default_:80>
        ...
        Protocols h2 h2c http/1.1
        H2Direct on
      </VirtualHost>
    
  • Add the following lines in the default Apache HTTPS virtual host configuration file at /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf, inside the default VirtualHost directive, so that it looks like this:

      <VirtualHost _default_:443>
        ...
        Protocols h2 h2c http/1.1
        H2Direct on
      </VirtualHost>
    
  • Add the following lines in any Apache virtual host file defined inside the /opt/bitnami/apache/conf/vhosts/ directory, inside the default VirtualHost directive for each file, so that it looks like this:

    NOTE: Replace the PORT placeholder with the port number used by the virtual host.

      <VirtualHost 127.0.0.1:PORT _default_:PORT>
        ...
        Protocols h2 h2c http/1.1
        H2Direct on
      </VirtualHost>
    
  • After modifying the Apache configuration files, restart Apache to apply the changes.

      $ sudo /opt/bitnami/ctlscript.sh restart apache
    
Last modification February 9, 2023