This article will explain how to setup Nextcloud with http2 and php-fpm, Apache. Then enable it in Nextcloud configuration.
You can read more about http2 here.
If you have followed article how to install Nextcloud 23 on Ubuntu 20.04, most of the required packages are installed already.
We have to enable php-fpm configuration and disable php for Apache. On Apache side we have to disable mpm_preform module and enable mpm_event. Otherwise php-fpm won’t start/work.
Note: If you have PHP 8.0, change php7.4-fpm
to php8.0-fpm
. Anything with php7.4
can be replaced with php8.0
.
You can run the following commands one by one to enable or disable configurations and modules:
a2enconf php7.4-fpm
a2dismod php7.4
a2dismod mpm_prefork
a2enmod mpm_event
Restart Apache and enable php-fpm:
systemctl restart apache2
systemctl enable php7.4-fpm
If you have applied the changes to php.ini from the previous article, you will have to change them again but in /etc/php/7.4/fpm/php.ini. And make sure to restart php-fpm afterwards:
systemctl restart php7.4-fpm
All should be good now if there were no errors thrown by Apache and php-fpm. Last part of this setup is to add the following line to nextcloud.conf 443 block.
Protocols h2 http/1.1
Restart Apache:
systemctl restart apache2
To test, load your Nextcloud instance in the browser and click inspect by right clicking, switch to Network tab. If everything is configured properly, you will see something like this:
Great, you have a setup of Nextcloud with http2 now.