http2
須要https
支持,假設你已經有https證書
從源碼編譯安裝openresty
nginx
解壓: tar -xzvf openresty-VERSION.tar.gz cd openresty-VERSION/ 三連: ./configure make sudo make install
此時安裝的openresty
配置http2會報錯 the "http2" parameter requires ngx_http_v2_module
ui
從新編譯:./configure --with-http_v2_module
編譯完成後make
(不要make insall ,會覆蓋安裝)
編譯出的nginx在 openresty-1.13.6.2/build/nginx-1.13.6/objs/
裏
咱們之擁替換此二進制文件就行了spa
nginx -s stop
先中止nginx
rest
將openresty-1.13.6.2/build/nginx-1.13.6/objs/nginx
複製到/usr/local/openresty/nginx/sbin
code
不先中止nginx的話會出現 cp: 沒法建立普通文件'./nginx': 文本文件忙
而後將listen
的http2
配置上啓動nginx
應該就能夠看到blog
若是替換了新編譯的nginx
二進制文件仍是使用http1.1,檢查一下openssl
版本和編譯的模塊,openssl
版本需大於1.0.1
才能支持http2
圖片