https----------如何在phpstudy環境下配置apache的https訪問以及訪問http自動跳轉成https

一、首先在 httpd.conf裏面修改幾個地方php

  找到 #LoadModule ssl_module modules/mod_ssl.so 去掉前面的#ide

  Include conf/vhosts.conf  在這一行下面增長一行 Include conf/vhosts_ssl.conf 而後去conf文件夾裏面建立vhosts_ssl.confui

二、在vhosts_ssl.conf裏面寫入spa

  Listen 443
  SSLStrictSNIVHostCheck off
  SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL
  SSLProtocol all -SSLv2 -SSLv3
  <VirtualHost *:443>
      DocumentRoot "D:\phpStudy\zhifu"
      ServerName www.ceshi.com
      ServerAlias ceshi.com
      <Directory "D:\phpStudy\zhifu">
          Options FollowSymLinks ExecCGI
          AllowOverride All
          Order allow,deny
          Allow from all
          Require all granted
      </Directory>
      SSLEngine on
      SSLCertificateFile "D:\phpStudy\Apache\conf\zheng\2_www.ceshi.com.crt"
      SSLCertificateKeyFile "D:\phpStudy\Apache\conf\zheng\3_www.ceshi.com.key"
      SSLCertificateChainFile "D:\phpStudy\Apache\conf\zheng\1_root_bundle.crt"
  </VirtualHost>ip

三、將證書上傳到,上面配置寫的對應的路徑裏面ssl

四、在vhosts.conf裏面配置自動跳轉it

  <VirtualHost *:80>
      DocumentRoot "D:\phpStudy\zhifu"
      ServerName www.ceshi.com
      ServerAlias ceshi.com
         RewriteEngine On
         RewriteRule (.*) https://%{SERVER_NAME}$1 [R]
      <Directory "D:\phpStudy\zhifu">
         Options FollowSymLinks ExecCGI
         AllowOverride All
         Order allow,deny
         Allow from all
         Require all granted
      </Directory>
  </VirtualHost>io

五、以上要注意,我寫的ceshi的地方,都要改爲本身的module

相關文章
相關標籤/搜索