How to Enable HTTP/2 in Apache XAMPP

31 March 2022

Home » Blogs » Framework » How to Enable HTTP/2 in Apache XAMPP

The protocol is faster than because it can handle resource queues and handle them simultaneously.

HTTP/2 uses a single connection to send multiple streams of data at once so that one resource does not block another resource. does this by splitting the data into binary coded messages and numbering these messages so the client knows which stream each binary message belongs to.

Whereas HTTP/1.1 loads resource one by one, so if one resource can’t be loaded it will block all other resources behind it.

TOP TUTORIALS:  How to Easily Prevent Ransomware and Malware with SRP

Therefore has better performance and speed than

If you want to enable HTTP/2 on the Apache Web server, you can follow the guide that Bardimin made below.

1. Enabling Apache HTTP/2 Module

As a first step, you need to enable the HTTP/2 module on . Open the file “ httpd.conf ” which is the main configuration file of . If you are using , you can find it in “ C:\ \\conf\ httpd.conf ”.

http2 apache

Look for ” mod_http2.so ” and uncomment the line by removing the ” # ” sign .

.............
LoadModule http2_module modules/mod_http2.so
.............

2. Enable HTTP/2 Globally

You can enable the HTTP/2 protocol globally. If you enable it globally, all connections from the Apache Webserver will use that protocol.

TOP TUTORIALS:  How to disable Directory Listing using .htaccess

To enable it, you just need to add the following directive at the end of the “ httpd.conf ” file or in “ C:\ \apache\conf\ httpd.conf ” if you are using XAMPP.

Protocols h2 h2c http/1.1

3. Enable HTTP/2 on certain Virtual Hosts

Open the file “ httpd-vhosts.conf ” or “C:\ xampp \apache\conf\extra\ httpd-vhosts.conf ” if using XAMPP.

Then add the HTTP/2 protocol to the configuration:


	# Enable HTTP/2 protocol
	Protocols h2 h2c http/1.1
	
	DocumentRoot "C:\xampp\htdocs\MyWebsiteFolder"
	ServerName MyWebsite.com
	SSLEngine on
	SSLCertificateFile "conf/ssl.crt/server.crt"
	SSLCertificateKeyFile "conf/ssl.key/server.key"
	
		Options All
		AllowOverride All
	Require all granted    
	

After all the configuration is complete, save all the configuration files and Restart Apache to see the results.

TOP TUTORIALS:  FREE OF CHARGE!!! SSL certificates with Let’s Encrypt and Apache

4. Check if HTTP/2 is running

To check whether your web server is using the HTTP/2 protocol or not, you can use a such as Chrome, Firefox, and others.

The method is quite easy, you just open your website in a , and then you open ” Developer Tools ” with ( + + I) or right-click on the page and select ” Inspect “.

http2 inspect

0 Comments

Submit a Comment