Why? because is faster than old HTTP/1 from 1997. You can chcek your website here and test it.
- HTTP/2 is binary, instead of textual.
- Fully multiplexed, sending multiple requests in parallel over a single TCP connection, asynch
- It uses header compression
- It allows servers to “push” responses proactively into client caches instead of waiting for a new request for each resource
- It uses the new ALPN extension which allows for faster-encrypted connections since the application protocol is determined during the initial connection.
- It reduces additional round trip times (RTT), making your website load faster without any optimization.
- Domain sharding and asset concatenation is no longer needed with HTTP/2.
Prepare
phpver=php7.3
sudo apt update
sudo apt upgrade
sudo apt-get install $phpver-fpm
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf $phpver-fpm
sudo a2dismod $phpver
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo a2enmod http2
sudo service apache2 restart
Add at bottom following line to /etc/apache2/apache2.conf:
Protocols h2 h2c http/1.1
H2Push on
H2PushPriority * after
H2PushPriority text/css before
H2PushPriority image/jpg after 32
H2PushPriority image/jpeg after 32
H2PushPriority image/png after 32
H2PushPriority application/javascript interleaved
Explanation: h2 is TLS-encrypted HTTP/2, h2c is cleartext HTTP/2, and http/1.1 is ordinary HTTP/1.1. H2Push on – force HTTP/2 usage. H2PushPriority – defines the priority handling of pushed responses based on the content-type of the response
Go to https://tools.keycdn.com/http2-test and test against your’s website