PHP 配置默认SSL CA证书

1、从CURL 官网下载CA 证书(当然也可以选择自己创建SSL CA证书,详情参考 https://blog.csdn.net/scuyxi/article/details/54898870 ,或自行百度)

CA 证书下载地址:https://curl.haxx.se/docs/caextract.html 页面去选择下载

或:https://curl.haxx.se/ca/cacert.pem

2、在PHP安装目录下新建一个文件夹cacert 来存放CA证书

修改php.ini配置

启用openssl, curl扩展

搜索 extension ,去掉需要开启扩展前的分号注释

extension=curl

extension=openssl

搜索 [curl] 和 [openssl] ,找到curl 和oppenssl 配置模块

;配置CA 证书存放位置

curl.cainfo= H:/phpapache/php-7.2.7-ts-x64/cacert/cacert.pem
openssl.cafile=H:/phpapache/php-7.2.7-ts-x64/cacert/cacert.pem

;配置CA 证书目录
openssl.capath=H:/phpapache/php-7.2.7-ts-x64/cacert

3、Apache 配置 SSL 证书

参考:https://jingyan.baidu.com/article/22fe7cedda56213002617f0d.html

先申请SSL证书

开启 OpenSSL module 模块

LoadModule ssl_module modules/mod_ssl.so 去掉全面的 # 号

若是电子商务网站或安全性要求高的网站不推荐DV SSL(Domain Validation SSL 是只验证域名所有权的SSL证书)

猜你喜欢

转载自www.cnblogs.com/zwesy/p/9461833.html