Loading... ### 安装依赖 本站基于 Centos7+Oneinstack 搭建,如果你使用其它发行版,与包管理有关的命令请自行调整。 首先安装依赖库和编译要用到的工具: ```shell yum -y install build-essential libpcre3 libpcre3-dev zlib1g-dev unzip git ``` ### 获取必要组件 ```shell ngx_brotli cd /root/oneinstack/src git clone https://github.com/google/ngx_brotli.git cd ngx_brotli git submodule update --init cd ../ ``` #### OpenSSL 为了支持 TLS 1.3 final,需要使用 OpenSSL 1.1.1 正式版: ```shell wget http://mirrors.linuxeye.com/oneinstack/src/openssl-1.1.1.tar.gz tar xzf openssl-1.1.1.tar.gz ``` #### Pcre ```shell wget http://mirrors.linuxeye.com/oneinstack/src/pcre-8.42.tar.gz tar xzf pcre-8.42.tar.gz ``` ### 编译并安装 Nginx 接着就可以获取 Nginx 源码,编译并安装: ```shell wget -c http://nginx.org/download/nginx-1.15.6.tar.gz tar zxf nginx-1.15.6.tar.gz cd nginx-1.15.6 make clean ./configure —prefix=/usr/local/nginx —user=www —group=www —with-httpstub_status_module —with-http_v2_module —with-http_ssl_module —with-http_gzip_static_module —with-http_realip_module —with-http_flv_module —with-http_mp4_module —with-openssl=../openssl-1.1.1 —with-openssl-opt=’enable-tls1_3 enable-weak-ssl-ciphers’ —with-pcre=../pcre-8.42 —with-pcre-jit —with-ld-opt=-ljemalloc —add-module=../ngx_brotli make mv /usr/local/nginx/sbin/nginx{,date +%m%d} #备份现有nginx cp objs/nginx /usr/local/nginx/sbin/ #更新nginx nginx -t #检查nginx语法 ``` enable-tls1_3 是让 OpenSSL 支持 TLS 1.3 的关键选项;而 enable-weak-ssl-ciphers 的作用是让 OpenSSL 继续支持 3DES 等不安全的 Cipher Suite,如果你打算继续支持 IE8,才需要加上这个选项。 #### WEB 站点配置 在 Nginx 的站点配置中,以下两个参数需要修改: ```shell ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # 增加 TLSv1.3 ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5; ``` 包含 TLS13 是 TLS 1.3 新增的 Cipher Suite,加在最前面即可;如果你不打算继续支持 IE8,可以去掉包含 3DES 的 Cipher Suite。 `service nginx restart` <font color="#E53333">***ps:最新版的oneinstack已经原生支持tls v1.3***</font> <hr class="content-copyright" style="margin-top:50px" /><blockquote class="content-copyright" style="font-style:normal"><p class="content-copyright">版权属于:LiangKe.org</p><p class="content-copyright">本文链接:<a class="content-copyright" href="https://www.liangke.org/10.html">https://www.liangke.org/10.html</a></p></blockquote> 最后修改:2020 年 07 月 23 日 11 : 10 PM © 允许规范转载 赞赏 如果觉得我的文章对你有用,请随意赞赏 ×Close 赞赏作者 扫一扫支付 支付宝支付 微信支付
本站默认最低支持TLS v1.2,开启TLS v1.3+0RTT。 WIN7使用IE8~10会出现协议不匹配,导致显示不安全。