Now a days everyone want to open his website more Fast and quick load its assets. For this your one need could be of using HTTP/2.0
What is HTTP/2.0 ?
HTTP/2 is a major revision of HTTP, developed for fast devlivery, reduce latency and minimize the protocol overheading. This works on Transport layer.
Features of HTTP/2:
- Reduces latency for fast loading the page.
- Multiplexing of request and response.
- Header compression
- Prioritizing the requests
- It can be used over Secure (HTTPS) with TLS and non-secure (HTTP) protocols, but all the major browsers like Mozilla, Chrome, IE,Safari, Edge had stated that they will supoort HTTP/2 only with Secure Version of HTTP means HTTPS with TLS). Thus HTTPS is mandatory for using HTTPS over these browsers.
Getting started to upgrade:
Here is the process to upgrade the HTTP version of your Apache from HTTP/1.1 to HTTP/2.0 on Ubuntu.
- Install / Upgrade to latest version of Apache:
Check the latest version with:If need upgrade then use the following command:1apache2 -vOr, alternativly you can use to install above:1sudo add-apt-repository ppa:ondrej/apache2Once the PPA is added, upgrade your system12deb http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial maindeb-src http://ppa.launchpad.net/ondrej/apache2/ubuntu xenial main12sudo apt updatesudo apt upgrade - Enable FASTCgi
If you are already using the module php7.1-fpm then skip this step. Here I am using PHP-7.1 on my server. You can respectivly change the version as per your requirement.If you have not installed the above module then follow these steps:(replace with 7.0 if needed). Enable proxy_fcgi and setenvif also.1sudo apt install php7.1-fpmNow enable above installed module1sudo a2enmod proxy_fcgi setenvifDisable PHP module for some time, we will restart it lateron1sudo a2enconf php7.1-fpmRestart apache1sudo a2dismod php7.11sudo service apache2 restart - Switch the Multi-Processing Module from prefork to event or worker:
As the HTTP/2 does not support prefork we have to switch this apache module to “event” or “worker”.Restart Apache and PHP 7.112sudo a2dismod mpm_preforksudo a2enmod mpm_event12sudo service apache2 restartsudo service php7.1-fpm restart - Update your Virtual-hosts or root host
If you want the HTTP/2 on individual host then put the following command anywhere between <VirtualHost>………</VirtualHost> tags.Or if you want to apply it on all your websites then append above code in global /etc/apache2/apache2.conf1Protocols h2 h2c http/1.1 - Time to enable http2 module and restart your serverDone!12sudo a2enmod http2sudo service apache2 restart
You can now verify by hitting your website’s URL (hosted on this server) in your browser and INSPECT ELEMENT tool.