添加SSL证书后,需要输入https:/ awlays。

问题描述 投票:0回答:1

我从某公司买了一个SSL证书,我已经把它安装在我的Windows 2016服务器IIS 10.它的绑定像下面的图像。

当我输入 https:/example.com 它工作得很好... 但是当我输入 example.com 然后它就会转到IIS的默认站点,以及当我输入 https:/www.example.com 它工作正常,但当我输入www.example.com,然后它转到默认的IIS网站。 enter image description here

这意味着,当我输入https:/,然后它工作正常... ... 但通常情况下,用户输入example.com或www.example.com ...因此,我如何配置这一个为上述要求?

security ssl iis windows-server-2016 iis-10
1个回答
1
投票

这正是你当前网站绑定的结果。

https:/docs.jexusmanager.comtutorialsbinding-diagnostics.html#background

所以我的建议是:

  1. 在此基础上再添加HTTP绑定,这样一来 http:/example.comhttp:/www.example.com 可以由这个网站处理,而不是默认网站。
  2. 安装URL重写模块,然后添加一个或多个规则来重定向HTTP流量到HTTPS。大量的文章帖子遍布互联网上。

1
投票

当你在浏览器中输入example.com或www.example.com,客户端就会通过http发送一个请求,而不是https,比如 http:/example.com.

由于你的网站需要https,所以需要SSL会被选中。你不能在同一个网站下同时托管http和https绑定。否则,要求SSL握手会破坏URL重定向规则,请安装URL重写模块,并将此规则放在您的Default网站下。

enter image description hereenter image description here

请安装URL重写模块,并将此规则放在您的默认网站下。

 <rule name="HTTPS force" enabled="true" stopProcessing="true">
 <match url="(.*)" />
 <conditions>
 <add input="{HTTPS}" pattern="^OFF$" />
 </conditions>
 <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
 </rule>
© www.soinside.com 2019 - 2024. All rights reserved.