24.07.2025

How to Enable and Configure HTTP/2 in Apache on CentOS 8

HTTP/2 is a modernized version of the traditional HTTP protocol, designed to improve website speed and reduce the load on both the web server and network bandwidth. These enhancements not only lead to better performance and lower infrastructure costs, but can also positively impact your site's search engine ranking. In this tutorial, we’ll walk through the steps to enable and configure the HTTP/2 protocol on an Apache web server running CentOS 8. To begin, make sure you have a properly configured server with Apache installed and SSL enabled.

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.

In the Serverspace you can create a server with already installed app "Apache".

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.

Conclusion

Enabling HTTP/2 on your Apache server running CentOS 8 is a straightforward process that brings significant performance benefits. By supporting features like multiplexing and header compression, HTTP/2 reduces latency and improves load times for your website users. Additionally, since most browsers require HTTPS for HTTP/2, configuring an SSL certificate is a crucial step. With just a few commands and configuration edits, your server can take advantage of this modern protocol—enhancing both user experience and SEO potential.

FAQ