CentOS Stream 10
Sponsored Link

Apache httpd : Configure mod_http22025/01/29

 

Configure [mod_http2] to use HTTP/2.

[1]

Configure SSL/TLS settings, refer to here.
(many Web browsers support HTTP/2 only on HTTPS connection)

[2] On RHEL / CentOS Stream, [mod_http2] is installed with [httpd] package for dependency but if not installed, Install it.
[root@www ~]#
dnf -y install mod_http2
[3] Configure [mod_http2].
It's possible to set it for each virtual hostings.
# [mod_http2] module is enabled by default

[root@www ~]#
cat /etc/httpd/conf.modules.d/10-h2.conf

LoadModule http2_module modules/mod_http2.so
# configure [mod_http2] to any virtual host sites you'd like to set

[root@www ~]#
vi /etc/httpd/conf.d/dlp.srv.world.conf
# add [Protocols ***] line

<VirtualHost *:443>
    Protocols h2 http/1.1
    DocumentRoot "/var/www/dlp"
    ServerName dlp.srv.world:443
    ErrorLog logs/dlp_ssl_error_log
    CustomLog logs/dlp_ssl_access_log combined
    SSLEngine on
    SSLHonorCipherOrder on
    SSLCipherSuite PROFILE=SYSTEM
    SSLProxyCipherSuite PROFILE=SYSTEM
    SSLCertificateFile /etc/letsencrypt/live/dlp.srv.world/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/dlp.srv.world/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/dlp.srv.world/chain.pem
</VirtualHost>

[root@www ~]#
systemctl restart httpd
# verify accesses
# OK if [HTTP/2] is shown

[root@www ~]#
curl -I https://dlp.srv.world/

HTTP/2 200
last-modified: Wed, 29 Jan 2025 01:56:49 GMT
etag: "0-62cce9f6e42a6"
accept-ranges: bytes
content-type: text/html; charset=UTF-8
date: Wed, 29 Jan 2025 01:57:18 GMT
server: Apache
  It's possible to see HTTP/2 in response header from Web browser access. The example below is on Google Chrome.
If HTTP/2 is enabled, [Protocol] in response header turns to [h2] like follows.
Matched Content