一起源码网

  • www.171739.xyz
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 高级进阶 查看主题

微信小程序https安全链接 阿里云 ssl证书 部署

发布者: queemst | 发布时间: 2018-1-9 00:42| 查看数: 2145| 评论数: 1|帖子模式

作者: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

  1. PS C:\PS> test.ps1

在 PowerShell中运行以下内容, 然后重启服务器

  1. # Enables TLS 1.2 on windows Server 2008 R2 and Windows 7
  2. # These keys do not exist so they need to be created prior to setting values.
  3. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2"
  4. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"
  5. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"
  6. # Enable TLS 1.2 for client and server SCHANNEL communications
  7. new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "Enabled" -value 1 -PropertyType "DWord"
  8. new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
  9. new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "Enabled" -value 1 -PropertyType "DWord"
  10. new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -name "DisabledByDefault" -value 0 -PropertyType "DWord"
  11. # Disable SSL 2.0 (PCI Compliance)
  12. md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server"
  13. new-itemproperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" -name Enabled -value 0 -PropertyType "DWord"
  14. # 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"

初次执行脚本时,可能会碰到一个异常:

  1. File
  2. C:\PS\test.ps1
  3. cannot be loaded because the
  4. execution
  5. of scripts is disabled on this system. Please see
  6. get-help
  7. about_signing for
  8. more
  9. details.
  10. At
  11. line:1 char:10

这是powershell的默认安全设置禁用了执行脚本,要启用这个功能需要拥有管理员的权限。 
开启:set-executionpolicy remotesigned 
关闭:Set-ExecutionPolicy Restricted

最新评论

她6982 发表于 2022-5-8 22:14
网页免费源代码

一起源码让程序更轻更快

www.171739.xyz

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表