Apache 2.x 部署SSL证书教程

第一步:修改apache目录下的httpd.conf配置文件

1、#LoadModule ssl_module modules/mod_ssl.so删除行首的配置语句注释符号“#”

2、Include extra/httpd-ssl.conf 将这行的注释的“#”去掉

第二步编辑extra/httpd-ssl.conf文件,修改如下内容:

1.ServerName 后面改成你的网站域名,可以不带端口号
DocumentRoot后面改成网站路径
SSLCertificateFile 后面改成server.crt文件路径  
SSLCertificateKeyFile 后面改成server.key文件路径
SSLCertificateChainFile 后面改成ca.crt文件路径

1 SSLCertificateFile    /usr/local/apache/conf/2_www.domain.com_cert.crt
2 SSLCertificateKeyFile   /usr/local/apache/conf/3_www.domain.com.key
3 SSLCertificateChainFile  usr/local/apache/conf/1_root_bundle.crt

ErrorLog 这行开头的可以注释掉(前面加#号)
TransferLog 这行开头的可以注释掉(前面加#号)
CustomLog 这行开头的可以注释掉(前面加#号)

2.phpstudy配置指定路径访问https(仅供参考,可以不用)

RewriteEngine on

RewriteBase /

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

第三步保存退出,并重启Apache, 若有报错或者无法正常启动,请看错误日志。

Tip:小程序要求的 TLS 版本必须大于等于 1.2问题

phpstudy版本必须大于5.5n,5.5n需要64位vc11运行库支持

检测网站

原文地址:https://www.cnblogs.com/superslow/p/8858767.html