openresty/nginx升級http2

http2須要 https支持,假設你已經有https證書

從源碼編譯安裝openrestynginx

解壓:
tar -xzvf openresty-VERSION.tar.gz
cd openresty-VERSION/
三連:
./configure
make
sudo make install

此時安裝的openresty配置http2會報錯 the "http2" parameter requires ngx_http_v2_moduleui

從新編譯:./configure --with-http_v2_module
編譯完成後make (不要make insall ,會覆蓋安裝)
編譯出的nginx在 openresty-1.13.6.2/build/nginx-1.13.6/objs/
咱們之擁替換此二進制文件就行了spa

nginx -s stop先中止nginxrest

openresty-1.13.6.2/build/nginx-1.13.6/objs/nginx 複製到/usr/local/openresty/nginx/sbincode

不先中止nginx的話會出現 cp: 沒法建立普通文件'./nginx': 文本文件忙

而後將listenhttp2配置上啓動nginx應該就能夠看到blog

圖片描述

若是替換了新編譯的nginx二進制文件仍是使用http1.1,檢查一下openssl版本和編譯的模塊,openssl版本需大於1.0.1才能支持http2圖片

圖片描述

相關文章
相關標籤/搜索