Chinaunix首页 | 论坛 | 博客
  • 博客访问: 146932
  • 博文数量: 340
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3405
  • 用 户 组: 普通用户
  • 注册时间: 2021-05-14 14:39
文章分类

全部博文(340)

文章存档

2023年(69)

2022年(144)

2021年(127)

我的朋友

分类: 云计算

2021-12-10 10:00:15

phpStudy安装ssl证书 – HTTPS SSL 教程(ssl证书申请可以在蔚可云申请

一、修改apache目录下的 httpd.conf 配置文件

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

       2、增加一条引用语句   Include conf/vhostsssl.conf

二、

      1、在conf文件夹中创建一个vhostsssl.conf配置文件。

      2、编辑 vhostsssl.conf 文件,增加如下内容:

     Listen 443

     

      SSLEngine on

      SSLProtocol all -SSLv2 -SSLv3

      SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

      SSLCertificateFile "D:\phpStudy\SSL\2_trustauth.cn.crt"

      SSLCertificateKeyFile "D:\phpStudy\SSL\trustauth.cn.key"

      SSLCertificateChainFile "D:\phpStudy\SSL\1_root_bundle.crt"

      DocumentRoot  "c:\WWW\jsdxnb"

      

         Options +Indexes +FollowSymLinks +ExecCGI

             AllowOverride All

                Order allow,deny

          Allow from all

        Require all granted

       

         

  其中

      SSLCertificateFile 是指证书公钥

      SSLCertificateKeyFile   是指证书私钥

      SSLCertificateChainFile 是指根证书

三、phpstudy 配置指定路径访问 https(我这一步没有配置,不行的话可以在 .htaccess 文件中配置)。

     RewriteEngine on

     RewriteBase / 

     RewriteCond %{SERVER_PORT} !^443$

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

 

四、保存退出,并重启Apache。

ps:

Apache 启动不了,一般是配置文件不对,请大家耐心排查。一般启动不了是因为之前配置过SSL或者文件配置错误!

一般目录:phpStudy安装软件安装目录,C:\phpStudy\Apache\conf

以下是备用代码,这个也可以用。

Listen 443


SSLEngine On

SSLCertificateFile “D:/ssl/2_”

SSLCertificateKeyFile “D:/ssl/3_”

SSLCertificateChainFile “D:/ssl/1_root_”

#……

DocumentRoot “D:/APP”

ServerName xs.xingshili.vip:443

阅读(368) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~