Windows Server 2008 R2 中IIS启用TLS 1.2

栏目: 服务器 · 发布时间: 6年前

内容简介:Windows Server 2008 R2 中IIS启用TLS 1.2

由于项目需要用到PayPal, 就去研究了下PayPal,但是PayPal需要TLS 1.2, 就Google了一把,这里把整个流程写下来

准备

Tips:

  1. 公司服务器整体结构是 Windows Server 2008 R2+ IIS + PHP

  2. 使用PhpStudy,使用其他的也没问题

说一下win7也可以, 可以拿来做测试.如果使用Win7来测试,需要控制面板>程序和功能>启用和关闭Windows组件 开启IIS组件(怎样开启,自行Google)

如果服务器是apache,只需要使用高版本的php_openssl扩展就行了,选用apche+PHP5.5n我已经确认可用, php5.6会报错找不到某某加密函数

PayPal的需求是

  1. PHP_VERSION >= 5.3

  2. php_curl , php_openssl 必须启用

  3. composer(怎样安装参考 http://www.phpcomposer.com)

phpStudy切换到 IIS7/8 + PHP 5.5n

Windows Server 2008 R2 中IIS启用TLS 1.2

这里说一声, 选这 PHP 5.5之前的版本, 由于openssl扩展的版本过低, 可能不支持, 我选5.4就不支持

下载PayPal的sdk

地址: https://github.com/paypal/Pay...

克隆到你的网站目录

打开git bash

git clone https://github.com/paypal/PayPal-PHP-SDK.git paypal
cd paypal
composer update

其实就是把代码下载下来, 复制到paypal目录, 然后在目录在命令行执行 composer update

配置TLS1.2

分为2步, 添加TLS配置和禁用老的SSL版本

配置TLS1.2

提供两种方法, 选择其中一种就行了

手动设置

找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols 右键->新建->项->新建 TLS 1.1 , TLS 1.2
TLS 1.1和TLS 1.2 右键->新建->项->新建 Server , Client
在新建的Server和Client中都新建如下的项(DWORD 32位值), 总共4个

DisabledByDefault [Value = 0]
Enabled [Value = 1]

如图

Windows Server 2008 R2 中IIS启用TLS 1.2

直接导入注册表文件

如下, 是我从我的注册表里面导出来的, 新建文本文件, 后缀名改为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

[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
"Enable"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
"Enable"=dword:00000001

[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
"Enable"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault "=dword:00000000
"Enable"=dword:00000001

禁用老SSL配置

打开 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client 配置如下

DisabledByDefault [Value = 0]
Enabled [Value = 0]

Windows Server 2008 R2 中IIS启用TLS 1.2

测试

打开网站, 我的是部署到局域网的,

192.168.1.99/paypal/sample

Windows Server 2008 R2 中IIS启用TLS 1.2

Windows Server 2008 R2 中IIS启用TLS 1.2

如果你配置了apiContent是有数据出来的,我没有配置, 所以就只是 No Data

本文永久更新链接地址 http://www.linuxidc.com/Linux/2017-04/142744.htm


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

プログラミングコンテストチャレンジブック

プログラミングコンテストチャレンジブック

秋葉 拓哉、岩田 陽一、北川 宜稔 / 毎日コミュニケーションズ / 2010-09-11 / JPY 34.44

現在、プログラミングコンテストは数多く開催されています。Google Code Jam、TopCoder、ACM/ICPCなどの名前を聞いたことがある人も少なくないでしょう。本書で扱うのはそれらのような、問題を正確にできるだけ多く解くことを競うプログラミングコンテストです。 プログラミングコンテストは気軽に参加することができます。例えば、Google Code JamやTopCoderはイン......一起来看看 《プログラミングコンテストチャレンジブック》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具