How to enable http2 in Nextcloud under Docker?

I have Nextcloud running in Docker being accessed through a NGINX reverse proxy forcing https. Everything works fine, but despite having activated http2 in nginx (and confirming external services see it as enabled), the Nextcloud docker container always reports access is happening though http1.1 (see below).

I ran a2enmod http2 within the Nextcloud container and adding

<IfModule http2_module>
  ProtocolsHonorOrder On
  Protocols h2 http/1.1
</IfModule>

to Apache’s .conf and finally ranservice apache2 restart, but no change. a2enconf http2 says ERROR: Conf http2 does not exist!

So how do I enable http2 for Nextcloud in Docker?


Details:
Nextcloud version (eg, 20.0.5): 25.0.4.1
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 11 (bullseye)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.54 (Debian)
PHP version: 8.1.16

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' =>  '****',
  'passwordsalt' =>  '****',
  'secret' =>  '****',
  'trusted_domains' =>
  array (
    0 =>  '****',
  ),
  'datadirectory' => '/var/www/html/data',
  'trusted_proxies' => ['192.168.102.238 (ip address of nginx reverse proxy)'],
  'overwritehost' =>  '****',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'overwrite.cli.url' =>  '****',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud_db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' =>  '****',
  'dbpassword' => '****',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/apache2:

PROPFIND /remote.php/dav/files/admin/Photos/ HTTP/1.1" 207 1682 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0

hello @vankyan welcome to the forum :handshake:

I can’t say about Nginx but IMHO Docker NC -apache (aka default) image uses http2 behind traefik proxy

Please use the search - lot of issues have been discussed already