记录: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进行检测: