How to Configure HTTP/2 in Apache on CentOS 8
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.
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:
Apache configuration for HTTP/2
Make sure that the HTTP/2 module is enabled in Apache.
Output:
Open the configuration file for your virtual host and find the section VirtualHost *:443
It may also be in the domain-name.com-le-ssl.conf file. Add the Protocols parameter there.
Protocols h2 http/1.1
...</virtualhost>
Save and close the file, and then restart Apache.
Check if HTTP/2 works
You can check it this way:
Output:
...
Your Apache web server now uses the HTTP/2 Protocol.