Apache httpd : Configure mod_http22022/03/16 |
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 9 / CentOS Stream 9, [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
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, 15 Mar 2022 07:57:55 GMT server: Apache last-modified: Tue, 15 Mar 2022 07:57:42 GMT etag: "86-5da3d26c84ad7" accept-ranges: bytes content-length: 134 content-type: text/html; charset=UTF-8 |
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. |
Sponsored Link |