Ken*_*ach 21 iis powershell ssl certificate
我正在尝试使用PowerShell在IIS站点上为自签名/本地证书设置SSL证书.
我创建了证书:
$newCert = 
       New-SelfSignedCertificate 
       -DnsName www.mywebsite.ru 
       -CertStoreLocation cert:\LocalMachine\My
然后尝试设置SSL绑定:
get-item 
      cert:\LocalMachine\MY\$newCert.Thumbprint | 
      new-item -path IIS:\SslBindings\0.0.0.0!443
如以下帖子所示:http://www.iis.net/learn/manage/powershell/powershell-snap-in-configuring-ssl-with-the-iis-powershell-snap-in
此处还显示: Powershell IIS7 Snap in将SSL证书分配给https绑定
我也尝试过:
get-item 
      cert:\LocalMachine\MY\$newCert.Thumbprint | 
      new-item -path IIS:\SslBindings\*!443
无济于事,我没有在编辑站点绑定对话框中看到SSL证书集.
有什么想法吗?
Mar*_*ndl 32
您必须将证书分配给特定站点.
您可以使用Get-WebBinding cmdlet 检索站点的绑定信息,并使用以下AddSslCertificate函数设置SSL证书:
$siteName = 'mywebsite'
$dnsName = 'www.mywebsite.ru'
# create the ssl certificate
$newCert = New-SelfSignedCertificate -DnsName $dnsName -CertStoreLocation cert:\LocalMachine\My
# get the web binding of the site
$binding = Get-WebBinding -Name $siteName -Protocol "https"
# set the ssl certificate
$binding.AddSslCertificate($newCert.GetCertHashString(), "my")
| 归档时间: | 
 | 
| 查看次数: | 18945 次 | 
| 最近记录: |