启用原因
nginx
支持TLS
协议的SNI
扩展(Server Name Indication
,简单地说这个扩展使得在同一个IP
上可以以不同的证书配置不同的域名)。不过,SNI
扩展还必须有客户端的支持,另外本地的OpenSSL
必须支持它。
如果启用了SSL
支持,nginx
便会自动识别OpenSSL
并启用SNI
。是否启用SNI
支持,是在编译时由当时的 ssl.h
决定的 SSL_CTRL_SET_TLSEXT_HOSTNAME
,如果编译时使用的OpenSSL
库支持SNI
,则目标系统的OpenSSL
库只要支持它就可以正常使用SNI
了。
nginx
在默认情况下是TLS SNI support disabled
启用方法
根据自己的需求选择重新编译还是平滑升级
1 2 3 4 5 6 7 8
| $ wget http://nginx.org/download/nginx-1.10.3.tar.gz $ wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz $ tar zxf openssl-1.0.2k.tar.gz $ tar zxf nginx-1.10.3.tar.gz $ cd nginx-1.10.3 $ ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=../openssl-1.0.2k make && make install
|
1 2 3 4 5 6
| $ nginx -V nginx version: nginx/1.10.3 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) built with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled //已启用 configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-openssl=../openssl-1.0.2k
|
上一篇:CDN下nginx获取用户真实ip
下一篇:SNI问题