昨天前同事給了我一篇資訊

關於HTTP2的資訊

https://blog.alphacamp.co/2016/07/12/http2/

我自己將自己的部落格設定了一下

簡單的流程有三個步驟

1.SSL憑證,有免費的,當然最好是花錢

2.WEB SERVER的設定(apache、nginx相關)

3.驗證(確認http2成功)

 

SSL憑證的話,申請流程網路上都有,這邊就帶過

我這邊主要是調整NGINX的設定

NGINX如果要支援http2的話,需要在1.9x以上,我是直接安裝1.10

設定大致上是如下圖,我設定得比較簡單,當然也可以很嚴謹

擷取

主要是 http轉https

與SSL的 http2設定

還有SSL KEY等等的資訊

另外就是 HSTS的Header等

詳細參數如下列

ssl_certificate /etc/nginx/ssl/certificate.crt;
ssl_certificate_key /etc/nginx/ssl/private.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ‘ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS’;
ssl_prefer_server_ciphers on;

add_header Strict-Transport-Security max-age=15768000;

 

然後就是驗證,使用下面這個網址

https://tools.keycdn.com/http2-test

然後填上你的網址 例如 www.kilait.com

擷取

HTTP2通過