一个服务器要绑定多个HTTPS站点

默认情况一个服务器的IIS只能绑定一个HTTPS也就是443端口

要实现多个站点对应HTTPS只能更改IIS配置

地址:C:\Windows\system32\inetsrv\config\applicationHost.config、

默认一个站点带一个这样的配置

    <binding protocol="https" bindingInformation="*:443" />

修改成:

      <binding protocol="https" bindingInformation="*:443:www.baidu.om" />

切记需要对应的每个站点都修改。

 

appcmd set site /site.name:"wb_KamDai.PortalSystem.W
eb" /+bindings.[protocol='https',bindingInformation='*:443:www.wb.com']

 
 
IIS重定向组件 
 
注意首先要安装url重定向模块
   https://www.microsoft.com/zh-CN/download/details.aspx?id=7435
然后在web.config末尾添加如下代码
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="HTTP to HTTPS redirect" stopProcessing="true">
     <match url="(.*)" />
     <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
     </conditions>
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
    </rule>
   </rules>
  </rewrite>
    </system.webServer>
 
 
 
 
posted on 2016-08-24 11:44  davidkam  阅读(1172)  评论(0编辑  收藏  举报