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 国际许可协议发布,转载必须保留署名及链接。

posted on 2017-02-20 09:00  初开  阅读(8040)  评论(1编辑  收藏  举报

导航