2016-08-09 20 views
2

我試過很多教程,如何在Apache服務器上啓用http2;例如: -Apache(Ubuntu 14.04)上的HTTP/2不起作用

但沒有成功。

這裏是我的配置:

$ apache2 -v 
Server version: Apache/2.4.23 (Ubuntu) 

$ apachectl -M 
Loaded Modules: 
... 
http2_module (shared) 
... 
ssl_module (shared) 
... 

這裏是我的/etc/apache2/sites-available/default-ssl.conf

<IfModule mod_ssl.c> 
    <VirtualHost *:443> 

     ServerAdmin [email protected] 
     DocumentRoot /var/www/html 
     ServerName example.net 
     ServerAlias www.example.net 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 

     ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1 

     Protocols h2 http/1.1 

     SSLEngine on 
     SSLCertificateFile /etc/apache2/ssl/apache.crt 
     SSLCertificateKeyFile /etc/apache2/ssl/apache.key 

     <FilesMatch "\.(cgi|shtml|phtml|php)$"> 
       SSLOptions +StdEnvVars 
     </FilesMatch> 
     <Directory /usr/lib/cgi-bin> 
       SSLOptions +StdEnvVars 
     </Directory> 
     BrowserMatch "MSIE [2-6]" \ 
         nokeepalive ssl-unclean-shutdown \ 
         downgrade-1.0 force-response-1.0 
     BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown 

    </VirtualHost> 
</IfModule> 

當我試圖加載我的網頁(https://example.net )在鉻,我可以看到這個響應標題:

HTTP/1.1 200 OK 
Date: Tue, 09 Aug 2016 12:05:08 GMT 
Server: Apache/2.4.23 (Ubuntu) 
Upgrade: h2 
Connection: Upgrade, Keep-Alive 
Last-Modified: Thu, 30 Jun 2016 14:22:30 GMT 
ETag: "b18-5367f99a49580-gzip" 
Accept-Ranges: bytes 
Vary: Accept-Encoding 
Content-Encoding: gzip 
Content-Length: 538 
Keep-Alive: timeout=5, max=100 
Content-Type: text/html 

我是否錯過了什麼?你能給我任何提示嗎?

回答

1

更新Ubuntu 14.04到16.04做到了!

+0

對我來說並不是真正的工作:(我也使用ondrej ppa,一切都很到位,但仍然服務於1.1 – Jeff

2

定義「不起作用」。我看到升級標題對我來說看起來不錯。

我懷疑HTTPS設置有問題。

要麼你在openssl 1.0.1和使用Chrome(which requires openssl 1.0.2 for ALPN support)。在Firefox或Opera中檢查確認。

或2您使用的舊密碼是blacklisted under http/2。在可能的情況下添加以下配置以強制體面的HTTPS配置:

SSLProtocol all -SSLv2 -SSLv3 
SSLHonorCipherOrder on 
SSLCipherSuite "EECDH+AES128:EECDH+AES256:+SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RSA+3DES:!DSS" 
+0

謝謝您的評論。我產生了很多不同的密鑰,但沒有成功。我已經將Ubuntu從14.04更新到16.04,並且瞧。現在它的工作。 – DzeryCZ

0

您是否將Protocols h2 h2c http/1.1添加到/etc/apache2/apache2.conf

這對我有效。

之前它只在啓用網站的conf中。

相關問題