Enable HTTP2 in Apache and PHP. Enabling module http2 alone will change http version from HTTP/1.1 to HTTP2. We need to install additional PHP dependencies to help PHP work with HTTP2 configuration set in Apache
First step is to enable http2 module in apache.
sudo a2enmod http2
After enabling http2 module, add the protocol in the conf file. If SSL is enabled, add the line in ssl conf file. Here, we are assuming your site is configured with LetsEncrypt certificate.
nano /etc/apache2/sites-available/example.com-le-ssl.conf
Insert the directive below in conf file
<IfModule mod_ssl.c>
<VirtualHost *:443>
Protocols h2 h2c http/1.1
ServerName example.com
DocumentRoot /var/www/example.com
Restart and check status
sudo systemctl restart apache2
systemctl status apache2
sudo apt-get install php7.2-fpm
sudo a2dismod php7.2
sudo a2enconf php7.2-fpm
sudo a2enmod proxy_fcgi
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
It offers the following advantages: