https----------如何在phpstudy环境下配置apache的https访问以及访问http自动跳转成https
Posted 陶阳昊
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了https----------如何在phpstudy环境下配置apache的https访问以及访问http自动跳转成https相关的知识,希望对你有一定的参考价值。
1、首先在 httpd.conf里面修改几个地方
找到 #LoadModule ssl_module modules/mod_ssl.so 去掉前面的#
Include conf/vhosts.conf 在这一行下面增加一行 Include conf/vhosts_ssl.conf 然后去conf文件夹里面创建vhosts_ssl.conf
2、在vhosts_ssl.conf里面写入
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>
3、将证书上传到,上面配置写的对应的路径里面
4、在vhosts.conf里面配置自动跳转
<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>
5、以上要注意,我写的ceshi的地方,都要改成自己的
以上是关于https----------如何在phpstudy环境下配置apache的https访问以及访问http自动跳转成https的主要内容,如果未能解决你的问题,请参考以下文章