我有2个SSL网络服务器,我必须使用nginx处理。 我也有一个http服务器(重定向工作正常)。
当我只处理http和https(只有一个ssl网络服务器)时,重定向效果很好。
问题是,当我想处理2个ssl网络服务器时:
na.test.lan for https nnm.toast.lan for https
https请求由第一个服务器块文件处理,该文件将我重定向到错误的ssl webserver(可能是侦听端口443的第一个服务器块)。
这是我的ssl.conf:
server {
listen 443;
server_name na.test.lan ;
ssl on;
ssl_certificate /etc/pki/nginx/server.crt;
ssl_certificate_key /etc/pki/nginx/server.key;
ssl_session_timeout 1m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://172.17.100.200/; }
}
server {
listen 443;
server_name nnm.toast.lan ;
ssl on;
ssl_certificate /etc/pki/nginx/server.crt;
ssl_certificate_key /etc/pki/nginx/server.key;
ssl_session_timeout 1m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://179.60.192.3/; }
}
答案 0 :(得分:0)
这是我的解决方案,它最终有效:
ssl_certificate /etc/pki/nginx/server.crt;
ssl_certificate_key /etc/pki/nginx/server.key;
HTTPS server configuration
server {
listen 443;
server_name na.test.lan ;
ssl on;
ssl_session_timeout 1m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://172.17.100.200/;
}
}
server {
listen 443;
server_name na.toast.lan ;
ssl on;
ssl_session_timeout 1m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://172.17.201.2/;
}
}
server {
listen 443;
server_name na.tist.lan ;
ssl on;
ssl_session_timeout 1m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://172.17.202.2/;
}
}
答案 1 :(得分:-2)
您应该为每个SSL服务器使用不同的IP地址。这就是SSL协议的本质,必须在建立连接的过程中完成SSL握手,因此服务器必须选择SSL证书发送给客户端。但此时它并不知道Host:header,所以它只选择第一个。
更新:或使用SNI http://nginx.org/en/docs/http/configuring_https_servers.html#sni