Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP/2 support #2096

Closed
dretsa opened this issue Nov 6, 2023 · 3 comments
Closed

Add HTTP/2 support #2096

dretsa opened this issue Nov 6, 2023 · 3 comments

Comments

@dretsa
Copy link

dretsa commented Nov 6, 2023

This image does not support HTTP/2, which reduces performance by a big chunk when opening previews of a lot of files. On my instance, scrolling too quickly on the photos page causes the server to hang as HTTP/1.1 has limited simultaneous connections to the server (depending on the browser).

I tried to enable HTTP/2 myself by using a Dockerfile and a2enmod/a2dismod:

a2dismod mpm_prefork
a2enmod mpm_event
a2enmod http2

The PHP is not thread-safe, therefore Apache is throwing warnings like this:

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.

Would be nice to get HTTP/2 working, and possibly HTTP/3 soon :P

Discussion on HTTP/2 on php-apache docker image: docker-library/php#742

@joshtrichards
Copy link
Member

joshtrichards commented Nov 6, 2023

HTTP/2 gets enabled on your front-end (i.e. your reverse proxy) where your TLS terminates. There's no TLS/SSL/HTTPS on the app server or in the Docker image (https://github.com/nextcloud/docker#https---ssl-encryption). Also, using anything other than mpm_prefork with mod_php is not recommended: https://www.php.net/manual/en/install.unix.apache2.php. Another option is avoid mod_php entirely and use the fpm (php-fpm) image: https://github.com/nextcloud/docker#using-the-fpm-image

The end result is the same: HTTP/2 takes place on your front-end (nginx, Apache, etc.)

...which reduces performance by a big chunk when opening previews of a lot of files. On my instance, scrolling too quickly on the photos page causes the server to hang as HTTP/1.1 has limited simultaneous connections to the server (depending on the browser).

Is that just a guess or do you have evidence that suggests that is the cause? Preview generation is a whole different topic in Nextcloud. There are various approaches but:

@marlemion
Copy link

HTTP/2 gets enabled on your front-end (i.e. your reverse proxy) where your TLS terminates.

I am not sure whether this statement is really true. I am trying to enable http2 in my nextcloud docker setup as well and I am failing.

Reason is that the app memories tells me that I am on http/1.1

I have a setup with a reverse proxy (apache), which is accessible from the internet and redirects to an internal docker instance. I check the http protocol with the following command:

curl -sI HOST -o/dev/null -w '%{http_version}\n'

If I check for the outside domain (i.e. my reverse proxy) I get version 2. When I check from within, i.e. from the actual host system onto the docker image, the version is 1.1. I have tried to enable http2 on the docker image with a2enmod http2, but the version stays on 1.1

As the reverse proxy reports the correct protocol, it appears that the docker image is the problem here. Hence, I do not understand the statement made above.

@joshtrichards
Copy link
Member

joshtrichards commented Nov 13, 2024

Use the fpm variant of our image. You can do whatever you want.

Also, see docker-library/php#558 (our images are derived from the PHP image set).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants