配置步骤如下:
1、检查Nginx是否支持TLS
$ nginx -V ... TLS SNI support enabled ...
2、如果出现TLS SNI support disable,就得升级openssl版本,并且重新编译nginx。
具体步骤如下:
首先下载openssl(建议下载1.0.1h版本)
#wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
下载Nginx
#wget http://nginx.org/download/nginx-1.9.9.tar.gz
解压openssl
#tar -zxvf openssl-1.0.1h.tar.gz
解压nginx,并编译
#tar -zxvf nginx-1.9.9.tar.gz #cd nginx-1.9.9 #./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-openssl=../openssl-1.0.1h/ #make && make install
#检查Nginx版本信息
#/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.9.9 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-55) built with OpenSSL 1.0.1h 5 Jun 2014 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-openssl=../openssl-1.0.1h/
配置Vhost中的域名证书
server { ######### listen 80; listen 443 ssl; #listen [::]:80; server_name we.baohua.me; root /home/wwwroot/we.baohua.me; ssl on; ssl_certificate_key /home/wwwroot/cert/we.baohua.me.key; ssl_certificate /home/wwwroot/cert/we.baohua.me.crt; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; ############### }
然后,重启Nginx即可。