Apache2 : Configure mod_http22022/05/17 |
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] | 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:~# vi /etc/apache2/sites-enabled/dlp.srv.world.conf # add [Protocols ***] line
<VirtualHost *:443>
Protocols h2 http/1.1
DocumentRoot /var/www/dlp
ServerName dlp.srv.world:443
ServerAdmin webmaster@dlp.srv.world
ErrorLog /var/log/apache2/dlp_ssl_error_log
CustomLog /var/log/apache2/dlp_ssl_access_log combined
SSLEngine on
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>
<Directory "/var/www/dlp">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
root@www:~# a2enmod http2 Enabling module http2. To activate the new configuration, you need to run: systemctl restart apache2
root@www:~#
systemctl restart apache2
# verify accesses # OK if [HTTP/2] is shown root@www:~# curl -I https://dlp.srv.world/ HTTP/2 200 last-modified: Thu, 01 Sep 2022 00:47:10 GMT etag: "29af-5e792f41ed553" accept-ranges: bytes content-length: 10671 vary: Accept-Encoding content-type: text/html date: Thu, 01 Sep 2022 00:49:39 GMT server: Apache/2.4.52 (Ubuntu) |
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 |
|