- 哈P哥2012-07-27论坛元老34143
我按照这文章操作了下,怎么不行啊?
概述
传统的每个SSL证书签发,每个证书都需要独立ip,假如你编译openssl和nginx时候开启TLS SNI (Server Name Identification) 支持,这样你可以安装多个SSL,绑定不同的域名,可以共享同一个ip。nginx支持TLS协议的SNI扩展(Server Name Indication,简单地说这个扩展使得在同一个IP上可以以不同的证书serv不同的域名)
较早前唯一的办法是签署一个通配证书,即 CNAME 中为 *.delphij.net 这样的证书,即采用的是泛域名的形式进行绑定。
但是对于不是泛域名的证书无法实现一个IP绑定多个证书。 下面讲到的TLS SNI技术可以实现一个IP绑定多个证书。
目的
使用https://ssl.15099.net和https://selfssl.15099.net 使用同一ip,可以配置https,测试环境:美国VPS+CentOS
编译openssl支持TLS SNI
cd /usr/src/
wget http://www.openssl.org/source/openssl-0.9.8l.tar.gz
tar zxvf ./openssl-0.9.8l.tar.gz
cd ./openssl-0.9.8l
./config enable-tlsext
make
make install
cd ..编译nginx支持TLS SNI
cd /usr/src/
wget http://nginx.org/download/nginx-0.7.67.tar.gz
tar zxvf nginx-0.7.67.tar.gz
cd nginx-0.7.67./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nobody\
--group=nobody\
--with-http_stub_status_module\
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client_temp/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi_temp/ \
--with-openssl=../openssl-0.9.8l/make
make install查看现在nginx是不是支持了TLS SNI
[root@www ~]# nginx -V
nginx version: nginx/0.7.67
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nobody --group=nobody --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client_temp/ --http-proxy-temp-path=/var/tmp/nginx/proxy_temp/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi_temp/ --with-openssl=../openssl-0.9.8l/
[root@www ~]#