Enable HTTP/2

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

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *

Anty-Spam test

ENG: Third planet of the solar system? PL: Trzecia planeta układu słonecznego?

  1.    Jupiter / Jowisz
  2.    Ziemia / Earth
  3.    Sun / Słońce
  4.    Wenus / Venus
  5.    Mars / Mars
  6.    Pluton / Pluto
  7.    Merkury / Mercury