Apache httpd : Configure mod_http22019/11/25 |
Configure [mod_http2] to use HTTP/2.
|
|
[1] |
Configure SSL/TLS settings, refer to here.
(many Web browser supports HTTP/2 only on HTTPS connection) |
[2] | On RHEL 8 / CentOS 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: Mon, 25 Nov 2019 07:06:40 GMT server: Apache last-modified: Mon, 25 Nov 2019 07:02:03 GMT etag: "86-59826573bcda8" accept-ranges: bytes content-length: 134 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 Firefox. If HTTP/2 is enabled, [X-Firefox-Spdy] in response header turns to [h2] on Firefox like follows. |
Sponsored Link |