zoukankan      html  css  js  c++  java
  • phpstudy 安装Apache SSL证书实现https连接

    Windows phpstudy安装ssl证书教程。

    工具/原料

     
    • phpstudy 集成环境
    • 申请的SSL证书

    方法/步骤

     
    1.  

      首先申请免费的ssl证书,很多地方都可以申请。我是在腾讯云!如图

      phpstudy 安装Apache SSL证书实现https连接
    2.  

      下载证书备份好。以免丢失。解压下载的证书,里面有4个文件夹相对应不同的安装环境,我们用的是Apache,所以选择这个。如图

      phpstudy 安装Apache SSL证书实现https连接
    3.  

      打开PHPstudy php扩展设置,在php_openssl上点击打钩。说明就打开了!如图

      phpstudy 安装Apache SSL证书实现https连接
    4.  

      打开修改httpd.conf配置文件,打开找到#LoadModule ssl_module modules/mod_ssl.so,去掉前面的注释符#(保证前面没有#号),使得ssl模块生效。

      增加一条引用语句   Include conf/vhostssl.conf

      phpstudy 安装Apache SSL证书实现https连接
      phpstudy 安装Apache SSL证书实现https连接
      phpstudy 安装Apache SSL证书实现https连接
    5.  

      如图在Apache/conf环境下新建vhostssl.conf文件;写入如下:

      Listen 443

      <VirtualHost *:443>

          DocumentRoot "C:myphp_wwwPHPTutorialWWW"

          ServerName www.test.com

          ServerAlias test.com

          SSLEngine on

          SSLProtocol TLSv1 TLSv1.1 TLSv1.2

          SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5

          SSLCertificateFile "C:myphp_wwwPHPTutorialApachecert2_www.test.com.crt"

          SSLCertificateKeyFile "C:myphp_wwwPHPTutorialApachecert3_www.test.com.key"

          SSLCertificateChainFile "C:myphp_wwwPHPTutorialApachecert1_root_bundle.crt"

      <Directory "C:myphp_wwwPHPTutorialWWW">

            Options +Indexes +FollowSymLinks +ExecCGI

            AllowOverride All

            Order allow,deny

            Allow from all

            Require all granted

        </Directory>

      </VirtualHost>

      其中

      SSLCertificateFile 是指证书公钥

      SSLCertificateKeyFile   是指证书私钥

      SSLCertificateChainFile  

      上面3个就是分别对应ssl证书放置的位置,请看下一步说明。

      DocumentRoot  "C:myphp_wwwPHPTutorialWWW"这是网站路径根据自己的,这是只是完成一半如果启动成功,那你就可以使用了 如果不成功请继续往下看

      phpstudy 安装Apache SSL证书实现https连接
    6.  

      在Apache目录下新建cert目录放入下载下来的Apache环境的ssl证书;如图;

      phpstudy 安装Apache SSL证书实现https连接
      phpstudy 安装Apache SSL证书实现https连接
    7.  

      然后重启Apache,用https访问网站,出现安全就说明成功了。

      phpstudy 安装Apache SSL证书实现https连接
    8.  

      细节配置;防火墙不要拦截443端口;

      最后在.htaccess里加入 实现http转跳到https上

      下列代码修改自己域名

      <IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{SERVER_PORT} 80RewriteRule ^(.*)$ https://www.chu.mn/$1 [R=301,L]</IfModule>

  • 相关阅读:
    C++重载运算符
    C++中的友元函数和友元类
    C++中的static关键字
    C++的new运算符和delete运算符
    git常用命令
    php+mysql+apache报错
    Nodejs 异步式 I/O 与事件式编程
    开始用Node.js编程
    Nodejs 模块
    Mac OS X上安装Node.js
  • 原文地址:https://www.cnblogs.com/zhousong918/p/10420598.html
Copyright © 2011-2022 走看看