nginx配置开启单个server下的TLS1.3

记录:nginx配置开启单个server下的TLS1.3功能,现有的nginx配置,开启TLS1.3是必须把服务器上面所有的server块里面的https下面都开启TLS1.3,才能生效。

解决办法:

针对这一现象,GitHub中找到ngx_http_ssl_client_hello_module模块可解决此问题,实现对单个server下的https开启TLS1.3功能。

一、下载安装ngx_http_ssl_client_hello_module模块

文档地址:https://github.com/zengjinji/ngx_http_ssl_client_hello_module

# cd 到openresty项目的nginx目录
cd /usr/local/src/openresty-1.15.8.3/bundle/nginx-1.15.8
# 克隆模块到目录
git clone https://github.com/zengjinji/ngx_http_ssl_client_hello_module.git
# 打补丁
patch -p1 < ./ngx_http_ssl_client_hello_module/nginx_1.16.1+.patch
# 编译
./configure --with-http_ssl_module --add-module=./ngx_http_ssl_client_hello_module --with-openssl=/usr/local/src/openssl-1.1.1g

二、编译openresty下的nginx
# cd 到openresty目录
cd /usr/local/src/openresty-1.15.8.3
# 编译
--------br压缩、http2、openssl-1.1.1g 、trim、pagespeed、http_ssl_client_hello、-----------
./configure   --add-module=/usr/local/src/ngx_brotli  --with-http_v2_module --with-openssl=/usr/local/src/openssl-1.1.1g  --add-module=/usr/local/src/ngx_http_trim_filter_module --add-module=/usr/local/src/incubator-pagespeed-ngx-1.13.35.2-stable --add-module=/usr/local/src/openresty-1.15.8.3/bundle/nginx-1.15.8/ngx_http_ssl_client_hello_module

三、将编译好的nginx配置文件替换项目中的nginx配置文件:

1,关闭nginx:./nginx -s stop (进到/usr/local/openresty/nginx/sbin目录执行)
2,将/usr/local/src/openresty-1.15.8.3/build/nginx-1.15.8/objs下的nginx配置文件复制,到/usr/local/openresty/nginx/sbin即可,记得sbin文件夹下面的nginx备份一下。

四、配置TLS1.3

1,在http下面,server上面开启模块:

	#开启http_ssl_client_hello模块
    ssl_client_hello on;

2,在server下面的https配置中添加 ssl_protocols TLSv1.3; 即可。
在这里插入图片描述

网页效果:
在这里插入图片描述

使用https://myssl.com进行检测:

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值