How to Enable HTTP/2 in Apache XAMPP

bardimin pic

Written by Bardimin

On March 31, 2022
Home » Blogs » Framework » How to Enable HTTP/2 in Apache XAMPP

The HTTP/2 is faster than HTTP/1.1 because it can handle resource queues and handle them simultaneously.

HTTP/2 uses a single TCP connection to send multiple streams of data at once so that one resource does not block another resource. HTTP/2 does this by splitting the data into coded messages and numbering these messages so the client knows which stream each 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.

Therefore HTTP/2 has better performance and speed than HTTP/1.1

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 Apache. If you are using , you can find it in “ C:\ \apache\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 globally. If you enable it globally, all connections from the Apache Webserver will use that protocol.

To enable it, you just need to add the following directive at the end of the “ httpd.conf ” file or in “ C:\ xampp \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 virtual host configuration:

<VirtualHost *:443>
	# 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"
	<Directory "C:\xampp\htdocs\ MyWebsiteFolder ">
		Options All
		AllowOverride All
	Require all granted    
	</Directory>
</VirtualHost>

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

4. Check if HTTP/2 is running

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

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

http2 inspect

Latest Articles

How to Sum Number Columns and Rows in a Microsoft Word Table

How to Sum Number Columns and Rows in a Microsoft Word Table

Microsoft Word is known as a popular program for editing documents, but did you know that you can also perform calculations in Word? One of the biggest challenges faced during the manual data entry process is the possibility of errors in performing numerical...

Redirect and Block URLs with HOSTS File on Windows

Redirect and Block URLs with HOSTS File on Windows

Redirect and Block URLs you can easily on Windows. Just by adding the IP of a website, you can redirect or block it. Of course, this is very useful to limit the access of your employees or children from accessing websites that you do not allow. Your Windows PC has...

Repeating and Keeping Table Headings on Each Page in Microsoft Word

Repeating and Keeping Table Headings on Each Page in Microsoft Word

Using tables is one efficient and organized way to display data in rows and columns. Good table formatting will make the table visually appealing. If you often work with Microsoft Word documents, chances are you need to periodically use tables when recording data. In...

How to Bypass Forgotten BIOS Password

How to Bypass Forgotten BIOS Password

If you have created a BIOS password for your PC/Laptop and forgot it, you may have to send it back to the manufacturer. Don't worry, there are still several methods you can use to bypass or unlock the BIOS password. The BIOS password serves as a form of authentication...

Basic Computer and Laptop Maintenance Techniques

Basic Computer and Laptop Maintenance Techniques

You may not realize it, but computers and cars have something in common, both requiring regular maintenance. If your car needs regular oil changes, your computer should also regularly update its software, keep its antivirus up to date, and check for spyware....