作者:nb009网,来自原文地址
下面我们介绍一下如何在阿里云部署免费的安全证书
登录阿里云 控制台-》安全(云盾)-》证书服务-》购买证书

第二步:购买证书

选中免费型DVSSL,点击购买付款然后一步步操作就OK了。买完后,再次回去证书服务,会看到一条待完成的记录

在待完成记录后面点击补全,把你的域名及相关信息填上即可。注意区分二级域名,因为只支付1个域名,二级域名需要单独申请

把证书绑定域名到阿里云这个勾上,然后下一步,自己创建生成提交就OK了
以上操作完成之后证书服务会出现等审核状态,那接下来就等待审核咯,审核通过后我们可以看域名解析里会多出一条CNAME记录,这就是刚才我们加的解析了,然后就OK

第三步:上面我们申请证书完成,接下来是如何把证书部署到服务器上呢?
我们再次回去证书服务列表页面,在审核通过的证书记录后面有个下载

这里已经写了如何部署到服务器上,步骤非常详细
首先先把好你服务器的类型,然后下载证书。接下来可以自己参照阿里云写的步骤操作了。

以上大功告成,可以通过浏览器该问一下该链接了。
注意:作者通过这个方法部署的SSL证书是1.1版本,到小程序上该问会提示需要使用SSL1.2版本。
二:小程序要求的 TLS 版本必须大于等于 1.2
微信小程序发现wx.request调试报错: 小程序要求的 TLS 版本必须大于等于 1.2

解决方法
执行powershell脚本
Powershell拥有自己的脚本,扩展名为“.ps1”.把下列内容复制保存成.ps1的后缀名,然后执行。
执行:开始->运行->cmd,在命令行下输入 PowerShell 进入 windows PowerShell
-
PS C:\PS> test.ps1
在 PowerShell中运行以下内容, 然后重启服务器
-
# Enables TLS 1.2 on windows Server 2008 R2 and Windows 7
-
-
# These keys do not exist so they need to be created prior to setting values.
-
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2"
-
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"
-
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"
-
-
# Enable TLS 1.2 for client and server SCHANNEL communications
-
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord"
-
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
-
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord"
-
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
-
-
# Disable SSL 2.0 (PCI Compliance)
-
md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server"
-
new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"
-
# Enables TLS 1.2 on Windows Server 2008 R2 and Windows 7 # These keys do not exist so they need to be created prior to setting values. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" # Enable TLS 1.2 for client and server SCHANNEL communications new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord" # Disable SSL 2.0 (PCI Compliance) md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"
初次执行脚本时,可能会碰到一个异常:
-
File
-
” C:\PS\test.ps1″
-
cannot be loaded because the
-
execution
-
of scripts is disabled on this system. Please see
-
“get-help
-
about_signing” for
-
more
-
details.
-
At
-
line:1 char:10
这是powershell的默认安全设置禁用了执行脚本,要启用这个功能需要拥有管理员的权限。 开启:set-executionpolicy remotesigned 关闭:Set-ExecutionPolicy Restricted
|