How to enable and configure HTTP/2 on Apache ubuntu - TechBeginner

Welcome to TechBeginner.in, Tech Beginner provides technical blog for Online Linux Tutorials, Ubuntu Tutorials, Redhat Tutorials and CentOS 7, Configuration of server like Web Server, Application server, Database server, Window server, networking, html, css, java script, php, wordpress, opencart, magento, joomla and etc.

How to enable and configure HTTP/2 on Apache ubuntu

Share This

Hypertext Transfer Protocol Version 2 (HTTP/2) is the most recent rendition of the HTTP convention, distributed as an IETF standard in RFC 7540 out of 2015. The focal point of the convention is on execution; explicitly, end-client saw dormancy, system and server asset use. One significant objective is to permit the utilization of a solitary association from programs to a Web website. The convention is in reverse good, so HTTP techniques, status codes, and semantics are equivalent to for past adaptations of the convention. Apache has HTTP/2 help since adaptation 2.4.17. Right now, going to expect that you as of now have a working TLS arrangement, and that you have required Apache variant introduced on your Linux conveyance of decision, and that you realize how to utilize Let's Encrypt, or you realize how to give a self-marked endorsement.


In this post, We will enable HTTP/2 protocol on Apache, Apache Web Server should be installed on the ubuntu.

Install Apache SSL Module 

Enable HTTP/2 support in Apache Web Server step by step by using the following commands.

$ sudo a2enmod ssl


Install Apache HTTP/2 Module

$ sudo a2enmod http2


VirtualHost configuration 

You need to add the HTTP/2 parameter to in apache virtual-host, The sample Apache virtual-host configuration with HTTP/2 parameters given below, Make the changes according to your requirement.


<VirtualHost *:443>
  ServerName your-domain.com
  ServerAlias www.your-domain.com
  DocumentRoot /var/www/public_html/your-domain.com   Protocols h2 http/1.1    SSLEngine on   SSLCertificateKeyFile /path/to/private.pem
  SSLCertificateFile /path/to/cert.pem
  SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
</VirtualHost>

Save and exit from the text editor.

Check the Apache webserver configuration using the commands.

$ apache2ctl configtest

To get effected you need to reload or restart the services.

$ sudo systemctl reload apache2

 Testing the HTTP/2 proto with the Apache web server by using the commands.

curl -I https://localhost

You should get the HTTP/2 proto on your screen.

No comments:

Post a Comment