If you are looking to speed up the loading time of your website or blog then you should enable http/2.0 in your web server. http/2.0 is the new updated HTTP protocol, and its supposed to be much more efficient than the now outdated http/1.1 version. I just enabled HTTP/2.0 on the web server running this blog, and I noticed a significant increase in speed.
This blog is using HTPPS which is slower than regular HTTP but a page load of 1.1 second is not bad. I ran some tests on internal pages with a lot of images too and the page load time was about 2 seconds, which is still not bad.
There are many benefits in upgrading your web server to HTTP/2.0, and the main benefit is speed. faster speed is achieved in HTTP/2.0 by supporting queries multiplexing, headers compression, priority and more intelligent packet streaming management. That causes to reducing latency and accelerate downloading any content of modern web pages, etc. HTTP/2.0 works with all current web platforms, so no additional configuration other than your webserver is needed.
The biggest http/2.0 drawback is the need to have TLS encryption support in your web server, in other words your blog or website needs to be HTTPS in order to get any benefit from the new protocol. the protocol itself supports encrypted and unencrypted connections, but mayor browsers like Google Chrome, Firefox, Safari, etc. have stated that they will only support http/2.0 over TLS so enabling http/2.0 without TLS encryption defeats the purpose.
HTTP/2.0 over TLS
The TLS requirement to use HTTP/2.0 might sound too costly for many, but nowadays you don’t need to spend a dime to change your website or blog to use HTTPS, there are many SSL vendors that have started giving out certificates for free. you just need to spend time configuring your web server. Places you get can free certificates that I know of are https://letsencrypt.org/ https://www.startssl.com/Support?v=1 and for 15 dollars a year you can get a certificate for a full year from this website https://sslmate.com/
Enabling HTTP/2.0 in Apache
Alright, let’s get a little bit more hands-on now. HTTP/2.0 is only available in Apache 2.4.17 or later. The apache version in Ubuntu 14.04, the current Ubuntu LTS server is Apache 2.4.7 so we need to use a PPA in order to upgrade Apache, and enable HTTP/2.0.
From terminal in your Ubuntu server run these commands one by one:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get install apache2
Enable the HTTP/2.0 module by typing this commands:
sudo a2enmod http2
Restart Apache to enable to module:
sudo service apache2 restart
Now open your VirtualHost file ( e.g. most likely at this path /etc/apache2/sites-available/ ) and put this code in:
Protocols h2 http/1.1
This is how my VirtualHost file looks like:
After you are done with that, reload your Apache server again:
sudo service apache2 reload
Go to https://tools.keycdn.com/http2-test and test if http/2.0 is detected in your domain. this is what I get:
Congratulations! your web server is HTTP/2.0 enabled now. test the speed of your site, and see if you notice any increase in page load.
7 people found this helpful
7 people found this helpful