解決微信小程序要求TLS版本不低於1.2問題


客官,本文可在我的小站中看到哦

昨天項目服務器發生意外,其上的IIS服務無法使用,導致項目后台癱瘓,倒騰一番最終以無法修復告終,啟用備用的服務器,從安裝IIS環境開始,然后最后所有的東西都准備就緒,卻發現微信小程序蘋果設備上無法使用,而安卓設備可以正常,心累……

環境

服務器:Windows IIS。

原因

ios9之后,蘋果要求所有的TLS(安全傳輸層協議)版本不低於1.2。

檢查

  • 方法一
    如何查看自己服務器的TLS版本呢,windows服務器上可直接到注冊表中查看
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\

下面如果有TLS 1.2節點,表示安裝了TLSv1.2。

  • 方法二
    利用https://myssl.com/ats.html進行檢測,輸入你的域名或者ip,查看檢測結果;

解決方案

  • 情況一:如果注冊表中有TLS1.2
    那么啟動很簡單,直接點擊它的ClientServer,分別將右側的Enable設為1,記住,是設為1,注意兩個都需要設為1。
  • 情況二:如果注冊表中沒有TLS1.2
    通常Windows服務器默認沒有TLS1.2,此時需要自己安裝,安裝很簡單,復制下面代碼,保存到txt文件中,修改后綴名為.reg,雙擊執行即可。如果有提示,則選擇允許或者確定之類的就可以了。
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

上面在新建的時候就已經賦值1了,不需要再去手動更改,如果需要關閉相應的版本,直接修改Enable值為0即可。

  • 最后一步,重啟服務器,重啟服務器,重啟服務器,切記,重啟服務器,重啟服務器,重啟服務器。

然后就可以看到下圖了,心情真好,小程序也通了。

最后

生命不息,使勁造吧


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM