Xym*_*nek 4 https apache-2.4 alpn
我创建了一个带有“LAMP 18.04”预设的 DigitalOcean Droplet 并进行了所有更新。配置新的虚拟主机并使用 certbot 配置 HTTPS。到目前为止一切都工作正常。然后我尝试启用 HTTP2:
a2enmod http2Protocols h2 http/1.1HTTPS虚拟主机但是,浏览器在连接到站点时仍然使用 HTTP/1.1(禁用缓存)。运行时curl --http2 -v https://example.com(域混淆)将打印以下内容:
* Connected to example.com (1.1.1.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
...
* SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
... And in headers:
< Upgrade: h2
< Connection: Upgrade
Run Code Online (Sandbox Code Playgroud)
此外,https://tools.keycdn.com/http2-test显示以下内容:
我的问题是 - 为什么选择 http/1.1?另外,为什么该工具认为 HTTP2/ALPN 已禁用?这是完整的 VHost 配置:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/example/www
Protocols h2 http/1.1
ErrorLog ${APACHE_LOG_DIR}/example/error.log
CustomLog ${APACHE_LOG_DIR}/example/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
<FilesMatch "^index\.html$">
Include no-cache.conf
</FilesMatch>
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias www.example.com
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)