nativeInstalleropenproject

Enable HTTP/2 support with Apache

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.

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:

Approach A: Bitnami installations using system packages

  • Add the following lines in the default Apache HTTP virtual host configuration file at installdir/apache2/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 installdir/apache2/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 installdir/apache2/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 installdir/ctlscript.sh restart apache
    

Approach B: Self-contained Bitnami installations

  • Add the following lines in the default Apache virtual host configuration file at installdir/apache2/conf/bitnami/bitnami.conf, inside the default VirtualHost directives, so that it looks like this:

      <VirtualHost _default_:80>
        ...
        Protocols h2 h2c http/1.1
        H2Direct on
      </VirtualHost>
    
      ...
    
      <VirtualHost _default_:443>
        ...
        Protocols h2 h2c http/1.1
        H2Direct on
      </VirtualHost>
    

    Repeat the above change for any other virtual hosts you may have defined.

  • After modifying the Apache configuration files, restart Apache to apply the changes.

      $ sudo installdir/ctlscript.sh restart apache
    
Last modification June 16, 2021