Get Started with Serverspace CLI

How to Configure HTTP/2 in Apache on CentOS 8

Joe Harris
November 27, 2020

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


LoadModule http2_module modules/

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

nano /etc/httpd/conf.d/

It may also be in the file. Add the Protocols parameter there.

<virtualhost :443>
Protocols h2 http/1.1

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


HTTP/2 200

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

Start Your Cloud Journey Migration made simplified. Take the first step right now.
We use cookies to provide our services and for analytics and marketing. To find out more about our use of cookies, please see our Privacy Policy. By continuing to browse our website, you agree to our use of cookies.