加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

如何告诉nginx仅为一个域提供SSL?

发布时间:2020-12-13 21:07:57 所属栏目:Nginx 来源:网络整理
导读:是的,这与this question重复,但是,根据ngnx文档“Configuring HTTPS servers”(“单个HTTPS服务器”部分),此限制不再存在,并且该问题的答案不再有效. 从上面的链接: Prior to 0.7.14 SSL could not be enabled selectively for individual listening socket

是的,这与this question重复,但是,根据ngnx文档“Configuring HTTPS servers”(“单个HTTPS服务器”部分),此限制不再存在,并且该问题的答案不再有效.

从上面的链接:

Prior to 0.7.14 SSL could not be enabled selectively for individual listening sockets,
as shown above. SSL could only be enabled for the entire server using the ssl
directive,making it impossible to set up a single HTTP/HTTPS server. The ssl
parameter of the listen directive was added to solve this issue. The use of the ssl
directive in modern versions is thus discouraged.

但是,在该doc中按照规定设置服务器块:

server {
        listen *:80;
        listen 443 ssl;

        server_name  example.com *.example.com;
[...]

…当发出https://example.net请求时,nginx仍会提供来自example.com的内容.

我知道SSL是在HTTP请求之前提供的,但必须有一些方法可以防止服务器响应没有与之关联的有效SSL证书的SSL请求.

我们非常感谢您对此的任何见解.

最佳答案

there has to be some way to prevent the server from responding to SSL requests that do not have a valid SSL associated with them

好吧,有点.由于您在同一IP上运行多个站点,因此尝试与任何站点的IP建立SSL连接的用户将始终建立其SSL连接(如果他们指向的是非主机名,则可能会出现证书错误由证书涵盖).

您可以采取的所有措施是防止在该IP上侦听SSL(在不同地址上运行SSL内容).

如果您对他们获得与该潜在错误的SSL连接没问题,那么您可以选择以下选项;而不是从启用SSL的服务器获取内容,您可能有一个默认值,它们收到403错误或重定向到他们发送请求的主机名的http侦听器 – 这些选项中的一个对您的系统有意义?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读