![](/img/trans.png)
[英]Powershell IIS7 Snap in Assign SSL certificate to https binding
[英]How to add created certificate to an IIS https binding using PowerShell
我可以使用PowerShell創建自簽名證書:
$cert = New-SelfSignedCertificate –DnsName www.test.com -CertStoreLocation “cert:\LocalMachine\My”
我還可以為我的網站創建綁定:
New-WebBinding -Name "Test" -IPAddress "*" -Protocol "https" -Port 443 -HostHeader www.test.com -SslFlags 1
但是,根據文檔New-WebBinding沒有可以接受證書的參數, 請參閱:New-WebBinding文檔
題
如何正確使用創建的證書創建https綁定?
從這個相關的問題 。 將127.0.0.1替換為您的IP地址:
Import-Module Webadministration
$IPAddress = '127.0.0.1' #your IIS server IP address
New-WebBinding -Name "Default Web Site" -Protocol "https" -IPAddress $IPAddress -Port 443 -HostHeader "www.test.com"
$SSLCert = Get-ChildItem –Path "cert:\LocalMachine\My" |
Where-Object {$_.subject -like 'cn=www.test.com*'}
New-Item "IIS:SslBindings\$IPAddress!443" -value $SSLCert
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.