Nginx配置HTTP2.0 1
Http2.0已经发布很久了,其优点前篇文章已经介绍过了HTTP2-0原理解析,今天我们来配置Nginx使其支持Http2.0
安装前必读:
- Nginx1.10.0以上版本才支持Http2.0,如果使用的是Tengine,版本需要大于2.2.1
- Http2.0只支持Https协议的网站,且openssl版本需要高于1.0.2
一、查看当前Nginx安装了哪些模块(如果事先没有安装Nginx,请忽略此步骤)
> /usr/sbin/nginx -Vnginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
可以看到http2.0模块--with-http_v2_module
已经存在了,方便演示就重新执行一遍
二、安装,升级
这里以最新版的Tengine为例
> wget http://tengine.taobao.org/download/tengine-2.2.3.tar.gz
> cd tengine-2.2.3
> ./configure --prefix=/usr/share/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module# 执行make编译
> make# 如果是首次安装Nginx,执行make install;如果是升级,执行make upgrade
> make upgrade# 完成后查看已经安装的模块,可以发现已经有http2(--with-http_v2_module)模块了
> nginx -V
三、配置Nginx
Nginx配置http2很简单,只需要在listen的端口后新增http2标识即可,如下
server {listen 443 ssl http2;server_name hostname.com;ssl_certificate cert/214547145790616.pem;ssl_certificate_key cert/214547145790616.key;location / {proxy_pass http://localhost:12345;}
}
四、检查http2是否生效
打开chrome控制台,在Name一栏右键把Protocol勾选上
欢迎订阅「K叔区块链」 - 专注于区块链技术学习
博客地址:http://www.jouypub.com
简书主页:https://www.jianshu.com/u/756c9c8ae984
segmentfault主页:https://segmentfault.com/blog/jouypub
腾讯云主页:https://cloud.tencent.com/developer/column/72548
Nginx配置HTTP2.0 1相关推荐
- Nginx配置HTTP2.0
Nginx配置HTTP2.0 Http2.0已经发布很久了,其优点前篇文章已经介绍过了HTTP2-0原理解析,今天我们来配置Nginx使其支持Http2.0 安装前必读: Nginx1.10.0以上版 ...
- 初次使用nginx 搭建http2.0
为什么80%的码农都做不了架构师?>>> 源码的下载地址 http://nginx.org/ 目前1.9.5已经加入http2.0的支持, 编译参数 ./configure - ...
- nginx安装http2.0协议
HTTP2协议 HTTP 2.0 的主要目标是改进传输性能(视频插件路数),实现低延迟和高吞吐量. 编译安装nginx #1.安装依赖 [root@node1 ~]# yum install -y g ...
- http2.0的时代来了
KS Knowledge Sharing 知识分享 现在是资源共享的时代,同样也是知识分享的时代,如果你觉得本文能学到知识,请把知识与别人分享! 开篇HTTP发展的心路历程 上图:连接无法复用 上图: ...
- HTTP的前世今生(HTTP1.1,HTTPS,SPDY,HTTP2.0,QUIC,HTTP3.0)
本文将从HTTP不断发展的时间线来讲解与其相关的知识点,其中包括HTTP1.1,HTTPS,SPDY,HTTP2.0,QUIC,HTTP3.0等,文章中内容涉及面较广,属于扫盲级别,不会特别深入某个知 ...
- http2.0 的时代来了
来源:https://www.jianshu.com/p/712eb3a65d33 作者:互扯程序 日期:2017.12.28 原文如下: 0. 开篇HTTP发展的心路历程 连接无法复用 设置Conn ...
- HTTP1.0 HTTP1.1 HTTP2.0总结
https://mp.weixin.qq.com/s/GICbiyJpINrHZ41u_4zT-A https://blog.csdn.net/striveb/article/details/8423 ...
- HTTP1.0,HTTP1.1,HTTP2.0,SPDY,HTTPS你应该知道的一些事
作为一个经常和web打交道的程序员,了解这些协议是必须的,本文就向大家介绍一下这些协议的区别和基本概念,文中可能不局限于前端知识,还包括一些运维,协议方面的知识,希望能给读者带来一些收获,如有不对之处 ...
- go学习笔记 http2.0使用【SAN 和双向认证】以及dotnetcore5.0的调用
简单说一下我的环境 win7+go1.15.6,GO1.15 X509 不能用了 ,需要用到SAN证书, 证书 需要用到SAN证书,下面就介绍一下SAN证书生成.首先需要下载 OpenSSL ht ...
最新文章
- Python之匿名函数
- 【STM32 .Net MF开发板学习-14】红外遥控器编码识别
- w7鼠标计算机无法识别,win7电脑遇见usb鼠标无法标识的详细处理步骤
- 文本分类实战技巧(tricks)汇总
- Java面试——MyBatis系列总结
- curd日志记录php,ThinkPHP学习之CURD操作(一)
- Mybatis Plus 的BaseMapper 和 Model有什么用
- 男人离婚后一般过得怎么样?
- UE4 android开发
- 程序批量将文本文件中的某字符替换
- 土壤类型空间分布数据介绍
- AForge Video
- android+ts+播放器,开源播放器ijkplayer的编译
- 订餐小项目-(适合公司内部使用)
- HDU6357 Hills And Valleys
- Docker基础介绍(二)
- SQL的删除语句delete(删除表中的数据)
- UserWarning: Glyph 20809 (\N{CJK UNIFIED IDEOGRAPH-5149}) missing from current font解决方法
- 台式电脑w ndows7密钥,windows7品牌机各版本oem密钥
- 黑马程序员:PHP为何能成最抢手后端语言?