在使用hostheader的IIS网站上设置现有SSL证书 [英] Setting existing SSL certificate on an IIS website which uses hostheader

查看:195
本文介绍了在使用hostheader的IIS网站上设置现有SSL证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的想法是自动将SSL证书链接到IIS 7或更高版本的网站。

The idea is to automate linking an SSL certificate to a website in IIS 7 or above.

服务器中的所有网站都使用相同的IP地址和相同的默认端口。所以它们都被它们的主机标题名称区分开来。

All the websites in a server use same IP address and same default port. So they are all differentiated by their host header names.

我可以手动实现这一点,没有任何问题。但是在自动化时存在问题。

I could achieve this manually without any issue. But while automating there is issue.

手动完成时,http.sys中的ssl配置条目记录为HostNameport TestName:443,而不是ipport xx.yy.za :443。

When done manually, the ssl configuation entries in http.sys are recorded as HostNameport TestName:443, not as ipport xx.yy.z.a:443.

所以我想模仿自动化工作的相同手动步骤。但它没有帮助。

So I wanted to mimic the same manual steps for automation to work. But it is not helping.

我尝试了以下步骤。


  1. 创建一个http.sys中的新ssl配置,主机名端口组合使用以下命令。

netsh - %http add sslcert hostnameport = Testssl:443 certhash = d70930bb790f89c04c728d9285b64f5fb0258fc7 appid = {01010101-0101-0101-0101-010101010101} certstorename = MY


  1. 使用hostheader名称为网站创建新的网页绑定。

  1. Create a new web binding for the website using hostheader name.

New-ItemProperty IIS:\ites.\\TestSite -name bindings -value @ {protocol =https; bindingInformation =192.168.1.108:443:Testssl}

New-WebBinding -Name TestSite -Protocol https -Port 443 -HostHeader Testssl -IPAddress 192.168.1.108

通过以上两个步骤,新绑定存在,但SSL证书未附加到绑定。

With the above two steps the new binding is present, but the SSL certificate is not attached to the binding.

是否不可以为http.sys ssl配置中相应主机名端口条目的绑定设置SSL证书吗?

Is it not possible to set SSL certificate for a binding with a corresponding hostname port entry in http.sys ssl configuration?

推荐答案

借助于来自Lex Li的评论,以下命令WORKS。

With the help of comment from Lex Li, the below command WORKS.

New-WebBinding -Name TestSite -Protocol https -Port 443 -HostHeader Testssl -IPAddress 192.168.1.108 -SslFlags 1

这篇关于在使用hostheader的IIS网站上设置现有SSL证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆