How to enable HTTP2.0

World Wide Web used HTTP protocol almost from its inception and provided the connection between server and client over the internet. The next upgrade HTTP1.1 solved a lot of base protocol issues. It was a vastly used protocol for web-based client and server communication.

Over time internet usage behavior changed. Websites and applications needed to adapt to new edge demands and volumes of traffic. HTTP/2 addressed HTTP 1.1 issues and offered

  • Header compression
  • Multiplexes connections in one TCP connection
  • Improved security as most browsers use HTTP/2 over HTTPS.
  • Better page load performance helps in SEO performance and user experience.

How to Check if Website Support HTTP/2

We can check whether the server is already supporting HTTP/2 with two methods. You can manually check the protocol column in developer tools or provide a website URL to free online tools.

Manually

Open IE/Chrome/Firefox; go to the Network tab and check the Protocol column. If you see h2 that means the server is responding over HTTP/2.

Online

You can use online tools like HTTP/2 Test tool

HTTP2 Browser Support

Note: Please note that before enabling HTTP/2, you must use SSL; as most browsers support HTTP/2 over secure HTTPS.

Implement HTTP/2 in Apache in Bitnami

We use the Bitnami image that comes with the mod_http2 module installed.

1) Edit the main Apache configuration file at /opt/bitnami/apache2/conf/httpd.conf and uncomment the line below so that it looks like this:

vim /opt/bitnami/apache2/conf/httpd.conf

2) Restart Apache

sudo /opt/bitnami/ctlscript.sh restart apache

Confirm that the http2 module is active:

sudo apachectl -M | grep http2

3) Open the file and add the following lines in the default Apache virtual host configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami.conf, inside the default VirtualHost directives,

$ vim /opt/bitnami/apache2/conf/bitnami/bitnami.conf
  <VirtualHost _default_:80>
    ...
    Protocols h2 h2c http/1.1
    H2Direct on
  </VirtualHost>

  ...

  <VirtualHost _default_:443>
    ...
    Protocols h2 h2c http/1.1
    H2Direct on
  </VirtualHost>

Repeat the above change for any other virtual hosts you may have defined, we have set it for port 80 and SSL port 443. Save the file.

4) Restart Apache to apply the changes.

$ sudo /opt/bitnami/ctlscript.sh restart apache

and that’s it. Your Apache server now supports HTTP/2.

About Author

Sorry, Comments are closed!