Set up HTTP2 support for Apache2 (Debian/Ubuntu)

Editions: Light, Ultimate (Standard), Ultimate (Extended), Corporate Enterprise, Corporate Campus
Versions: 5.0+

As of version 5.0, VIMP supports website delivery under HTTP/2. In this article, we describe how to enable HTTP/2 support for Apache 2.4 on Debian and Ubuntu.

In the following, we assume that you have already installed Apache with HTTP 1.1 by default. Thus, we describe only the changes to the previous default configuration. If you installed VIMP with Apache2 according to our Debian 11 instructions, then no further changes are necessary. Apache2 is then already configured for HTTP/2.

vHost Configuration

First, we add the HTTP/2 protocol to the vHost configuration:

nano /etc/apache2/sites-available/vimp.conf

Replace vimp.conf with the name of your existing VIMP vHost configuration, if necessary.

In the non-SSL section of your vHost config (usually port 80), add the following line before the closing VirtualHost tag:

Protocols h2c http/1.1


In the SSL area (usually port 443), add the following line:

Protocols h2 http/1.1


This line causes Apache2 to first attempt to load the requested page over HTTP/2. If this fails, the page is delivered over HTTP 1.1 as before.

Next, we install PHP-FPM. In the following we assume that you have installed PHP 7.4. If you are using an older version, please change the following commands accordingly (e.g. from php7.4-fpm to php7.3-fpm).

apt install php7.4-fpm

Then we disable the modules that are no longer needed.

a2dismod php7.4
a2dismod mpm_prefork

And enable the new modules:

a2enmod mpm_event
a2enmod rewrite
a2enmod proxy_fcgi setenvif
a2enmod ssl
a2enmod http2
a2enconf php7.4-fpm

We restart Apache later so that the new configuration is read in.

Configure PHP

Now we edit the php.ini for the FPM PHP module:

nano /etc/php/7.4/fpm/php.ini

and adjust the following lines as follows:

upload_max_filesize = 4096M
post_max_size = 4096M
register_argc_argv On
memory_limit = 1024M
max_execution_time = 60
max_input_time = 120

Save the file and restart Apache2 (for larger upload limits, increase the two 4096M values accordingly):

service apache2 restart

Your VIMP page is now delivered over HTTP/2.

Last update on 2022/02/02 by Admin.

Go back