Set up HTTP2 on Apache Virtualhosts

Follow these simple steps in order to implement the HTTP2 protocol for your websites :

  1. issue the command as root : # a2enmod http2
  2. Apply changes by restarting Apache2 : # systemctl restart apache2
  3. Add the following line in your virtualhost configuration file ie :

<VirtualHost *:443>




Protocols h2 http/1.1


  1. Reload the configuration with : # systemctl reload apache2


Prerequesites for running HTTP2 along with your Apache2 server

As we strive on getting the latest builds, we constantly update our server to keep it the most secure as possible, so issuing those commands above got us quickly to the point :

HTTP2 on Apache2

Our Apache2 server at the moment we are writing is at version 2.4.25 (# apache2ctl -version). The module is included with Apache2 and we only had to enable it and use it within our website. For more details about Apache2 and HTTP2, I invite you to read the page on

In order to run your server with http/2, you must meet the following requirements :

  • Version of Apache2 : 2.4.17 minimum

The rest is obvious, in the case you don’t have this version on your server, you may need to refer to our article on securing your web server (the link will be displayed here – currently updating).


What I will gain using Http/2 protocol ?

There is a whole page you can read to learn more about HTTP/2 from GitHub,

Basically in terms of security you will be better with HTTP/2 and HTTPS, in terms of performance however depending on the configuration of your server and the type of website requests you are making there won’t be significant improvement except whenever caching is relevant ( server push).


Now that you’ve set up your Apache server along with HTTP/2, I hope you enjoyed these lines and invite you to post any suggestions/questions here. I’ve also made a tutorial on implementing HTTPS, I will post it here soon.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Want more information?

Related links will be displayed within articles for you to pick up another good spot to get more details about software development, deployment & monitoring.

Stay tuned by following us on Youtube.

%d bloggers like this: