关于apache 开启 ssl https 支持 TLS1.2 的些事

项目背景

需要搭建一个小程序的服务器,当然要使用https协议
服务器windows service 2012 r2,后台语言是php,服务集成环境装的是appserv2.5 ,apache2.2
证书申请阿里云的,https协议能正常打开,就是小程序请求不了,要求TLS1.2
网上的文章基本都是旧的,而且没有说明apache版本,基本不适合你,还是要折腾
最后找到文章说apache的httpd版本低不支持TLS1.0以上

于是下载了最新版的appserv集成环境,apache2.4
基本上不用折腾,开启下就完美

正文

事先有折腾配置了系统的TLS支持,一般都是注册表的东西,类似这样,但不知有没有起作用
https://blog.csdn.net/kirawoo/article/details/78737242

 httpd.conf中开启(默认应该是开启的)

LoadModule ssl_module modules/mod_ssl.so

 
httpd.conf 开启加载配置文件

注意,这里是:httpd-ahssl.conf ,不是httpd-ssl.conf,

到httpd-ahssl.conf里面配置

已经内置好几个虚拟目录,映射不同的域名到不同的目录

选一个来改就好,改下web目录和证书路径,比如:<VirtualHost *:443>

  SSLEngine on
  ServerName localhost:443
  SSLCertificateFile "${SRVROOT}/cert/2002590_service.ktfqs.com_public.crt"
  SSLCertificateKeyFile "${SRVROOT}/cert/2002590_service.ktfqs.com.key"
SSLCertificateChainFile "${SRVROOT}/cert/2002590_service.ktfqs.com_chain.crt"
DocumentRoot "C:/AppServ/www" # DocumentRoot access handled globally in httpd.conf CustomLog "${SRVROOT}/logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b" <Directory "C:/AppServ/www"> Options Indexes Includes FollowSymLinks AllowOverride All Require all granted </Directory> </virtualhost>

ServerName不用绑定域名也可以访问,既然能访问就不管它
另外,原配置中,只有一行key文件,一行公共crt,要自己加一行:

SSLCertificateChainFile "${SRVROOT}/cert/2002590_service.ktfqs.com_chain.crt"

进行,否则 ,开发工具里可以请求,但真机上会报错request:fail ssl hand shake error


重启,完美

原文地址:https://www.cnblogs.com/vbyzc/p/10635294.html