СHRISTMAS
WHEEL OF FORTUNE

Tap the button and win a guaranteed prize right now!

By registering, you are signing up to receiving e-mails.
JH
Joe Harris
November 27 2020
Updated June 7 2023

How to Configure HTTP/2 in Apache on CentOS 8

CentOS Linux Web server

Using another OS?

Select the desired version or distribution.

The HTTP/2 protocol was created as a more advanced version of HTTP. It allows you to speed up the site and reduce the load on the web server and communication channel. All this leads to a reduction in costs and even an increase in the site's position in search engines. In this tutorial, we will configure HTTP/2 protocol in Apache web server on CentOS 8. To get started, you will need an
SSL certificate installed on Apache. You can use this tutorial - How to Setup Let’s Encrypt SSL on Apache. Most browsers only work with HTTP/2 over HTTPS.

Preparing the system

First, you need the latest version of Apache. Therefore, you need to update the packages in the system.

dnf upgrade

On CentOS/RHEL 8 systems mod_http2 is installed with Apache. To make sure that it is in the system, or install it if not:

dnf install mod_http2

Apache configuration for HTTP/2

Make sure that the HTTP/2 module is enabled in Apache.

cat /etc/httpd/conf.modules.d/10-h2.conf

Output:

LoadModule http2_module modules/mod_http2.so

Open the configuration file for your virtual host and find the section VirtualHost *:443

nano /etc/httpd/conf.d/domain-name.com.conf

It may also be in the domain-name.com-le-ssl.conf file. Add the Protocols parameter there.

<virtualhost :443>
Protocols h2 http/1.1
...</virtualhost>

Save and close the file, and then restart Apache.

systemctl restart httpd

Check if HTTP/2 works

You can check it this way:

curl -I https://domain-name.com

Output:

HTTP/2 200
...

Your Apache web server now uses the HTTP/2 Protocol.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.