Rocky_Linux_8
Sponsored Link

Apache httpd : Configure mod_http22021/08/03

 
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 8 / Rocky Linux 8, [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.
# configure [mod_http2] to any virtual host sites you'd like to set

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

LoadModule http2_module modules/mod_http2.so
# add [Protocols ***] line

[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
    TransferLog logs/dlp_ssl_access_log
    LogLevel warn
    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
date: Tue, 03 Aug 2021 01:17:59 GMT
server: Apache
last-modified: Mon, 02 Aug 2021 23:39:23 GMT
etag: "82-5c89c1436c764"
accept-ranges: bytes
content-length: 130
content-type: text/html; charset=UTF-8
  It's possbile to see HTTP/2 in response header from Web browser access. The example below is on Chrome.
If HTTP/2 is enabled, [Protocol] in response header turns to [h2] on Firefox like follows.
Matched Content