微信小程序开发交流qq群 581478349
承接微信小程序开发。扫码加微信。
正文:
SSL证书实现https,环境:phpStudy下Apache环境
前提条件:
1.申请并下载好腾讯云申请的免费 ssl证书
腾讯云免费证书申请地址: /product/ssl?fromSource=gwzcw.186131.186131.186131
2.phpstudy集成环境下正常运行的http网站
3.避免意外请先备份(复制)好httpd.conf配置文件。
方法/步骤:
1.点击打开修改httpd.conf配置文件,打开找到#LoadModule ssl_module modules/mod_ssl.so,去掉前面的注释符 #
3.在C:\phpStudy\PHPTutorial\Apache 目录下创建cert文件夹,把证书放进去
4.修改C:\phpStudy\PHPTutorial\Apache\conf 目录下的 vhosts.conf 文件
Listen 443<VirtualHost *:443>DocumentRoot "C:\phpStudy\PHPTutorial\WWW"ServerName www.haomall.wangServerAlias SSLEngine onSSLProtocol TLSv1 TLSv1.1 TLSv1.2SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5SSLCertificateFile cert/2_haomall.wang.crtSSLCertificateKeyFile cert/3_haomall.wang.keySSLCertificateChainFile cert/1_root_bundle.crt<Directory "C:\phpStudy\PHPTutorial\WWW">Options FollowSymLinks ExecCGIAllowOverride AllOrder allow,denyAllow from allRequire all granted</Directory></VirtualHost>
5.修改 C:\phpStudy\PHPTutorial\Apache\conf\extra 目录下的 httpd-ssl.conf 文件
# 添加 SSL 协议支持协议,去掉不安全的协议SSLProtocol all -SSLv2 -SSLv3# 修改加密套件如下SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUMSSLHonorCipherOrder onSSLCertificateFile cert/2_haomall.wang.crtSSLCertificateKeyFile cert/3_haomall.wang.keySSLCertificateChainFile cert/1_root_bundle.crt
windows下的PHP,只需要到php.ini中把
1. display_errors = On 修改为 display_errors = off
2. ;extension=php_openssl.dll前面的;删掉,重启服务就可以了。
其它系统安装配置证书可以考虑官方帮助文档:/document/product/400/4143