单个子域上的Nginx SSL而不是很多

时间:2013-08-01 02:17:34

标签: ssl nginx

我正在尝试仅为我网站的“API”子域设置SSL,这是我的SSL配置:

# HTTPS server
server {
  listen 443;
  server_name api.example.com;

  ssl                  on;
  ssl_certificate      /some_path/to/server.crt;
  ssl_certificate_key  /some_path/to/server.key;

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

  location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://site;
  }
}

然而,Nginx似乎也允许我连接到https://example.com。然后Firefox会要求我确认相同的证书(由我自己签名)。

我虽然使用server_name指令会将SSL限制为仅限于该子域,但现在它也允许对我的所有子域进行SSL请求。我错过了什么吗?

1 个答案:

答案 0 :(得分:2)

如果没有Server Name Indication,则服务于HTTPS内容的服务器不知道所请求的域名是什么(因为Host标头本身已加密)。因此,无论域名如何,对该IP的所有请求都将获得默认的SSL虚拟主机。

相关问题