HTTP/2, yes or no?

Good to know. I never faced issues with lower Apache version + mod_php + http/2 that time, but there will be a good reason.

To keep using Nextcloud .htaccess for e.g. pretty URLs and some other stuff I stay with mod-php (mpm_prefork) for now, but actually it should be easily possible to move those settings to Apache config/vhost and move o php-fpm (mpm_event).

php-fpm also reads the .htaccess file. The only directives Apache with php-fpm will not understand are the ones that are only available via the php Apache module. e.g. php_value , php_value, php_flag (logical, since the php module isn’t loaded).
However, PHP settings can still be set via the .user.ini file.

There are no changes necessary to the current .htaccess file when using Nextcloud with php-fpm.

If you have a working php-fpm setup, Nextcloud will run out of the box.

Update: Maybe my first sentence is a bit confusing. The .htaccess is read by Apache, not by php-fpm. I meant that it is still read, when php-fpm is used.

2 Likes

Ah thanks for clarification. Seems I mixed things up in my memory since I use both .htaccess and php_(admin_)value.

Since php values can be passed as well via php/fpm pool settings and .user.ini (?) the final benefit of mod-php decreases more and more. For low traffic instances it is at least not significantly slower than php-fpm, but as well not faster (?). The question is if there is any benefit nowadays or if fpm should be always recommended over mod-php?

IMO there’s no reason to use mod-php anymore.

php-fpm is a requirement, if you want to use:

  • a threaded Apache MPM
  • HTTP/2
  • several versions of PHP on the same server
1 Like

Seems so. I will see if I can do some single user access performance and resource usage test on clean machine. On heavy parallel access php-fpm definitely has clear advantage, but I couldn’t find some benchmark on calm server so far.

Just FYI I got this in my Debian update changelog:

apache2 (2.4.25-3+deb9u5) stretch; urgency=medium * This package upgrades mod_http2 to the version from apache2 2.4.33. This fixes a lot of bugs and some security issues, but it also removes the support for using HTTP/2 when running with mpm_prefork. HTTP/2 support is only provided when running with mpm_event or mpm_worker. –

Stefan Fritsch <sf@debian.org> Sat, 02 Jun 2018 09:51:46 +0200

It might also be worth noting that the Apache 2 ITK MPM doesn’t support HTTP/2, this Apache module is great for user seperation on shared servers but Nextcloud on shared servers probably isn’t a great idea…

Jep, this is the case since 2.4.27 (see above).

Hello,

I’m running this setup :
Raspberry
Apache 2.4 - event mpm - php7.3-fpm
MariaDB
Nextcloud 15 (with every recommandations done)

Now i’m wandering if I should enable http2 or not and it seems like it’s not always a good idea (slower ?).
Do some of you find out a way to optimize HTTP2 and to improve their Nextcloud setup ?

Best regards

I’ve try it on Cubietruck and with fpm I have higher CPU Load by PHP, but site opens much (around 1,5 time) quicker in compare to mpm. So, I stayed in fpm with http2 enabled.

I also find that basically my tiny CPU will always being utilized in 100% when I connect to the server. Difference is only in:

  1. By http 1.1 MariaDB will use it more CPU and PHP less,
  2. By http 2.0 PHP will use CPU more and MariaDB less.

At the end Http2.0 shows better results with same CPU utilization for me.

2 Likes

Well, I just tried and it seems to be way better with HTTP2 for now ! What a good news
I have to try that out for a while before I’m able to be sure.

1 Like

I wish that NC really used the new features like Push. It could really speed up things.