Apache (Ubuntu 14.04 上) を から にアップグレードしたところ2.4.7
、2.4.25
すべて正常になりました。その後、http2 モジュールを有効にして、仮想ホストに以下を挿入しました。
Protocols h2 http/1.1
その後、ブラウザでサイトを開こうとしましたが、読み込みが続くだけです。
私の SSL 設定は次のとおりです。
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/*/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/*/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/*/chain.pem
私の仮想ホストは次のとおりです:
DocumentRoot /home/mywebsite
ServerName mywebsite.com
</Directory>
<IfModule mod_php7.c>
php_admin_flag allow_url_fopen Off
php_admin_value open_basedir "/home/mywebsite/:/tmp/"
</IfModule>
<IfModule mod_headers.c>
Header unset ETag
Header set X-Frame-Options: deny
Header set X-XSS-Protection: "1; mode=block"
Header set X-Content-Type-Options: nosniff
Header set X-WebKit-CSP: "default-src 'self'"
Header set X-Permitted-Cross-Domain-Policies: "master-only"
Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
curl (curl -I hxxps://mywebsite.com) から試すと、次のようになります:
Upgrade: h2
Connection: Upgrade
また、ログ(アクセスとエラー)を確認しましたが、何もありません。
プロトコルを有効にした後、Web サイトが機能しなくなる理由について何か考えはありますかhttp2
?
ここで自分のウェブサイトをテストすると:https://tools.keycdn.com/http2-test私のサイトは HTTP/2.0 をサポートしていると表示されます。
LogLevel http2:info
からに変更した後LogLevel http2:debug
、error.log に次の内容が表示されます:
[Wed Jan 25 07:40:25.830096 2017] [http2:debug] [pid 5300] h2_session.c(1007): [client 192.168.1.25:43190] AH03200: h2_session(5) created, max_streams=100, stream_mem=65536, workers_limit=6, workers_max=1, push_diary(type=1,N=256)
[Wed Jan 25 07:40:25.830143 2017] [http2:debug] [pid 5300] h2_session.c(1109): [client 192.168.1.25:43190] AH03201: h2_session(5): start, INITIAL_WINDOW_SIZE=65535, MAX_CONCURRENT_STREAMS=100
[Wed Jan 25 07:40:25.830153 2017] [http2:debug] [pid 5300] h2_session.c(2073): [client 192.168.1.25:43190] AH03079: h2_session(5): started on mywebsite.com:443
[Wed Jan 25 07:40:25.830166 2017] [http2:debug] [pid 5300] h2_session.c(1742): [client 192.168.1.25:43190] AH03078: h2_session(5): transit [INIT] -- init --> [BUSY]
[Wed Jan 25 07:40:25.830196 2017] [http2:debug] [pid 5300] h2_session.c(661): [client 192.168.1.25:43190] AH03068: h2_session(5): sent FRAME[SETTINGS[length=6, stream=0]], frames=0/0 (r/s)
[Wed Jan 25 07:40:25.830206 2017] [http2:debug] [pid 5300] h2_session.c(661): [client 192.168.1.25:43190] AH03068: h2_session(5): sent FRAME[WINDOW_UPDATE[stream=0, incr=2147418112]], frames=0/1 (r/s)
[Wed Jan 25 07:40:25.830248 2017] [http2:debug] [pid 5300] h2_session.c(1742): [client 192.168.1.25:43190] AH03078: h2_session(5): transit [BUSY] -- no io (keepalive) --> [IDLE]
[Wed Jan 25 07:40:25.873960 2017] [http2:debug] [pid 5300] h2_session.c(439): [client 192.168.1.25:43190] AH03066: h2_session(5): recv FRAME[SETTINGS[length=12, stream=0]], frames=0/2 (r/s)
[Wed Jan 25 07:40:25.873992 2017] [http2:debug] [pid 5300] h2_session.c(439): [client 192.168.1.25:43190] AH03066: h2_stream(5-13): opened
[Wed Jan 25 07:40:25.874084 2017] [http2:debug] [pid 5300] h2_session.c(439): [client 192.168.1.25:43190] AH03066: h2_session(5): recv FRAME[HEADERS[length=331, hend=1, stream=13, eos=1]], frames=7/2 (r/s)
[Wed Jan 25 08:00:43.593021 2017] [http2:debug] [pid 6637] h2_session.c(439): [client 192.168.1.25:43518] AH03066: h2_session(21): recv FRAME[PING[length=8, ack=0, stream=0]], frames=10/3 (r/s)
[Wed Jan 25 08:00:43.593096 2017] [http2:debug] [pid 6637] h2_session.c(661): [client 192.168.1.25:43518] AH03068: h2_session(21): sent FRAME[PING[length=8, ack=1, stream=0]], frames=11/3 (r/s)
答え1
mod_http2 を実行するには nghttp が必要です。
設定に以下を追加します:
<IfModule http2_module>
LogLevel http2:info
</IfModule>
そして、完全な停止と開始で Apache を再起動します (単なる正常な再起動ではありません)。エラー ログには、次のような詳細が表示されます。
[Wed Jan 04 18:12:07.003271 2016] [http2:info] [pid 12345:tid 123456789012345] mod_http2 (v1.8.3, nghttp2 1.18.0), initializing...
[Wed Jan 04 18:12:07.004910 2016] [mpm_event:notice] [pid 12345:tid 123456789012345] AH00489: Apache/2.4.25 (Unix) OpenSSL/1.0.2j configured -- resuming normal operations
上記のあなたのバージョンを質問に追加してください。
アクセス ログにリクエストが届いているのがわかりますか? HTTP/1.1 ですか、それとも HTTP/2 ですか?
また、http2 モジュールを有効にしたと思いますか?
a2enmod http2
Apache を手動で起動し、root として以下を実行してエラーが発生するかどうかを確認できますか?
/etc/init.d/apache2 restart