Apache 开启 Https

1. 准备所需工具:

1) apache httpd2.4 浏览

2) Win32 OpenSSL v1.0.2d 浏览

2. 安装

2.1 安装Apache2.4服务

php环境搭建 浏览

2.2 安装OpenSSL

双击Win64OpenSSL-1_0_2d.exe进行安装即可。

3. 生成密钥

进入%OpenSSL%in目录

1) 生成密钥

openssl genrsa 1024 > server.key

2) 生成证书请求文件

openssl req -config D:Program_FilesApache24confopenssl.cnf -new -key server.key > server.csr

3) 生成证书

openssl req -config D:Program_FilesApache24confopenssl.cnf -x509 -days 365 -key server.key -in server.csr > server.crt

4. 配置

1) 将生成的server.key和server.crt文件拷贝到 D:Program_FilesApache24conf

2) 修改 D:Program_FilesApache24confextrahttpd-ssl.conf 

SSLCertificateFile "D:/Program_Files/Apache24/conf/server.crt"

SSLCertificateKeyFile "D:/Program_Files/Apache24/conf/server.key"

注意将此文件中所有的 "c:/apache24" 替换成你自己的安装目录

3) 修改 httpd.conf 文件

LoadModule ssl_module /opt/taobao/install/httpd/modules/mod_ssl.so

LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

4) 重启Apache服务

5) 打开网页 https://localhost

4. 参考

1) apache https配置步骤 浏览

原文地址:https://www.cnblogs.com/swordy/p/4675696.html