環境
服務器:Windows IIS。
原因
ios9之後,蘋果要求所有的TLS(安全傳輸層協議)版本不低於1.2。
檢查
- 方法一
如何查看自己服務器的TLS版本呢,windows服務器上可直接到註冊表中查看
Ctrl + R 打開命令端
輸入 "regedit" 打開註冊表
進入路徑:[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\
下面如果有TLS 1.2
節點,表示安裝了TLSv1.2。
- 方法二
利用https://myssl.com/ats.html進行檢測,輸入你的域名或者ip,查看檢測結果;
解決方案
- 情況一:如果註冊表中有TLS1.2
那麼啓動很簡單,直接點擊它的Client
和Server
,分別將右側的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即可。
- 最後一步,重要事情說三遍,重啓服務器!重啓服務器!重啓服務器!。
然後就可以看到下圖了,心情真好,小程序也通了。
如果還是不通,則檢查nginx配置文件,ssl_protocols 是否有配置 TLSv1.2