shenzhang 发表于 2018-11-22 13:21:09

基于apache配置https

  第一步:开启apache的ssl模块和配置文件
  LoadModule ssl_module modules/mod_ssl.so
      Include conf/extra/httpd-ssl.conf
  第二步:配置服务器的证书和私钥文件:
  1、设置环境变量:
set OPENSSL_CONF=D:\EnvPHP\Apache2.4\conf\openssl.cnf  2、生成服务器的私钥
D:\EnvPHP\Apache2.4\bin\openssl genrsa 1024>server.key  3、生成证书请求文件:
D:\EnvPHP\Apache2.4\bin\openssl req -new -key server.key > server.csr  第三步:签署服务器证书文件:
openssl req -x509 -days 365 -key server.key -in server.csr > server.crt  第四步:将server.crt、server.key 复制到apache的conf文件夹下,并配置httpd-ssl.conf文件:

SSLEngine on
DocumentRoot "D:/EnvPHP/Apache2.4/htdocs"
ServerName localhost:443
ServerAdmin admin@example.com
ErrorLog "D:/EnvPHP/Apache2.4/logs/error.log"
TransferLog "D:/EnvPHP/Apache2.4/logs/access.log"
SSLCertificateFile "D:/EnvPHP/Apache2.4/conf/server.crt"
SSLCertificateKeyFile "D:/EnvPHP/Apache2.4/conf/server.key"
  第五步重启Apache服务;以https进行访问,浏览器默认会报安全证书存在问题,点击继续浏览此网站即可




页: [1]
查看完整版本: 基于apache配置https