nginx HTTP/2.0 配置


1.前言

最近無意中看到http2.0消息,發現自己的博客雖然配了https,但並沒有配置http2.0,所以搞了個玩玩,本以為配個參數就搞定了,結果還是折騰了一個小時。

2.過程

nginx並沒有默認打包https2.0,所以得自行打包配置。

首先確認當前openssl版本,最低要求1.0.2,一般都不滿足,所以還得手動下載openssl。nginx也用最新的穩定版。

openssl version -a

wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
wget http://nginx.org/download/nginx-1.10.2.tar.gz
#解壓
tar zxf openssl-1.1.0e.tar.gz && tar zxf nginx-1.10.2.tar.gz

cd nginx-1.10.2
#通過--with-http_v2_module 打包http2 --with-openssl指定openssl目錄
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_v2_module --with-openssl=../openssl-1.1.0e

#make過程比較長,耐心等待
make 
make install

最后在nginx conf server下配置

listen 443 ssl http2;

重啟nginx,查看下請求:

作者:初龍

原文鏈接:https://chulung.com/article/nginx-http-2-configuration

本文由MetaCLBlog於2017-07-17 09:19:21自動同步至cnblogs

本文基於 知識共享-署名-非商業性使用-禁止演繹 4.0 國際許可協議發布,轉載必須保留署名及鏈接。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM