Apache httpd : Configure mod_http22021/03/15 |
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 / CentOS Stream 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. |
# [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: Fri, 12 Mar 2021 02:41:39 GMT server: Apache last-modified: Fri, 12 Mar 2021 02:41:27 GMT etag: "82-5bd4dd6353a16" accept-ranges: bytes content-length: 130 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 Firefox. If HTTP/2 is enabled, [X-Firefox-Spdy] in response header turns to [h2] on Firefox like follows. |
Sponsored Link |
|