本文我们就和大家分享一下phpStudy环境如何安装SSL证书。
第一步:修改apache目录下的httpd.conf配置文件
1、#LoadModule ssl_module modules/mod_ssl.so删除行首的配置语句注释符号“#”
2、Include extra/httpd-ssl.conf 将这行的注释的“#”去掉
第二步编辑extra/httpd-ssl.conf文件,修改如下内容:ServerName 后面改成你的网站域名,可以不带端口号
DocumentRoot后面改成网站路径
SSLCertificateFile 后面改成server.crt文件路径
SSLCertificateKeyFile 后面改成server.key文件路径
SSLCertificateChainFile 后面改成ca.crt文件路径
ErrorLog 这行开头的可以注释掉(前面加#号)
TransferLog 这行开头的可以注释掉(前面加#号)
CustomLog 这行开头的可以注释掉(前面加#号)
phpstudy配置指定路径访问https(仅供参考,可以不用)
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
第三步保存退出,并重启Apache。
如果发现apache无法启动,检查一下 openssl有没有启用。