以下配置环境为:Windows Server 2012 R2 , phpstudy v8.1部署环境
1、下载ssl证书上传
在apache文件夹下新建一个cert的文件,将三个证书文件放在这里,如图
2、phpstudy,php扩展选中php_openssl
3、在conf文件夹下新建vhostssl.conf
添加内容:
Listen 443 <VirtualHost *:443> FcgidInitialEnv PHPRC "C:/phpstudy_pro/Extensions/php/php5.6.9nts" AddHandler fcgid-script .php FcgidWrapper "D:/phpstudy_pro/Extensions/php/php5.6.9nts/php-cgi.exe" .php SSLStrictSNIVHostCheck off SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!aNULL:!eNULL; DocumentRoot "D:\phpstudy_pro\WWW\www.xxxx.com" ServerName www.xxxx.com ServerAlias www.xxxx.com <Directory "D:\phpstudy_pro\WWW\www.xxxx.com"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> SSLEngine on SSLCertificateFile "D:\phpstudy_pro\Extensions\Apache2.4.39\cert\2_www.xxxx.com.crt" SSLCertificateKeyFile "D:\phpstudy_pro\Extensions\Apache2.4.39\cert\3_www.xxxx.com.key" SSLCertificateChainFile "D:\phpstudy_pro\Extensions\Apache2.4.39\cert\1_root_bundle.crt" </VirtualHost>
说明:填写相应路径,如图示:
4、修改文件httpd-conf,打开配置文件的httpd-conf
查找#LoadModule ssl_module modules/mod_ssl.so,如果前面有#,去掉
增加一句Include conf/vhostssl.conf,就是引用你自己创建的vhostssl.conf
5、重启apache服务
6、检测是否正常,正常的话http和https都可以正常打开。
(注意:开启443端口)