天天看點

IIS多站點共享端口

背景:客戶在使用通配符證書進行IIS多站點配置中發現IIS不支援多站點共用一個SSL端口,使用多個站點綁定證書會提示“該證書已經綁定其他站點,如果要綁定目前證書會導緻在使用的站點證書不可用”,而且無法共用同一個443端口。

1、修改證書友好名稱

  • 點選“開始”=>“運作”=>“mmc”
  • 打開控制台,點選“檔案”=>“添加/删除管理單元”,找到“證書”點選“添加“,選擇“計算機賬戶”,點選“下一步”,選擇本地計算機,點選“完成”
  • 在“個人”中找到已經安裝成功的伺服器證書,并輕按兩下打開。

    在證書的詳細資訊中選擇“編輯屬性”

  • 并将友好名稱中的資訊删除,設定為“空” 點選“應用,确認”

2、然後通過修改配置檔案的方式進行證書端口綁定

  • 先停止IIS站點
  • 打開C:/Windows/system32/inetsrv/config/applicationHost.config
  • 搜尋你的站點名稱找到類似下面的配置項,做相應修改:
<site name="www" id="3">
      <application path="/" applicationPool="www">
       <virtualDirectory path="/" physicalPath="E:/Web/www" />
      </application>
      <bindings>
        <binding protocol="http" bindingInformation="*:80:www.itrus.cn" />
        <binding protocol="https" bindingInformation="*:443:" />
      </bindings>
    </site>           
<site name="cim" id="2" serverAutoStart="true">
      <application path="/"applicationPool="cim">
        <virtualDirectory path="/" physicalPath="E:/Web/cim" />
      </application>
      <bindings>
        <binding protocol="http" bindingInformation="*:80:cim.itrus.cn" />
        <binding protocol="https" bindingInformation="*:8443:" />
      </bindings>
    </site>           
  • 找到https的配置項目,修改為:
<binding protocol="http" bindingInformation="*:80:www.itrus.cn" />
<binding protocol="https" bindingInformation="*:443:www.itrus.cn" />

<binding protocol="http" bindingInformation="*:80:cim.itrus.cn" />
<binding protocol="https" bindingInformation="*:443:cim.itrus.cn" />           
  • 在443後面增加你的域名,儲存。
  • 再次啟動IIS,修改成功。

注意事項:如果站點在配置完成後再次重新開機則配置會失效,需要重新修改配置檔案。

繼續閱讀