【準備】php
(1)phpstudy下載:http://phpstudy.php.cn/apache
【開始】ide
(1)開啓apache的編譯ssl模塊,如圖打開phpstudy—其它選項設置—PHP擴張及設置—php擴展—php-openssl前面打勾網站
(2)如圖點擊打開修改httpd.conf配置文件,打開找到#LoadModule ssl_module modules/mod_ssl.so,去掉前面的註釋符#(保證前面沒有#號),使得ssl模塊生效。ui
在mod_ssl.so下面新增長一條引用語句(注意此處和第3步新建的文件名要匹配) :spa
LoadModule ssl_module modules/mod_ssl.so
Include conf/vhosts_ssl.conf
(圖2.1 打開方法)3d
(圖2.2 添加好信息效果)code
(3)依次打開phpstudy安裝文件,打開Apache打開conf文件,在conf文件夾 中建立一個名爲vhosts_ssl.conf的配置文件。編輯vhosts_ssl.conf文件,增長以下內容:server
圖3.1 新建的:vhosts_ssl.conf文件位置、效果圖示:blog
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\WWW\bbs" #(網站根目錄路徑) ServerName www.yuming.com #(更換成本身的域名) ServerAlias yuming.com #(更換成本身的域名) <Directory "D:\phpStudy\WWW\bbs"> #(網站根目錄路徑) Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> SSLEngine on SSLCertificateFile "D:\phpStudy\Apache\conf\ssl\XXX.cer" #(證書路徑) SSLCertificateKeyFile "D:\phpStudy\Apache\conf\ssl\XXX.key" #(證書路徑) </VirtualHost>
★vhosts_ssl.conf 實例版 a)軟件版本phpStudyLite 2014; b)本地版網站127.0.0.1; c)證書實際後綴名有變:cer變crt ; d) 全部路徑要結合實際,即便有一點點錯,也將致使Apache沒法啓動,務必仔細;
Listen 443 SSLStrictSNIVHostCheck off SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL SSLProtocol all -SSLv2 -SSLv3 <VirtualHost *:443> DocumentRoot "D:\phpStudyLite\WWW" ServerName 127.0.0.1 ServerAlias 127.0.0.1 <Directory "D:\phpStudyLite\WWW"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> SSLEngine on SSLCertificateFile "D:\phpStudyLite\Apache\conf\ssl\server.crt" SSLCertificateKeyFile "D:\phpStudyLite\Apache\conf\ssl\server.key" </VirtualHost>
最後打開網站加上https://127.0.0.1 便可看到效果:
==附件1:快速配置方法==================
1.扣盤 wifi破解 下載對應phpstudy2016前 或 2018的附件:[ ssl配置 phpstudy2016以前lite版 ] [ ssl配置 phpstudy2018版 ]
把httpd.conf 和 vhost_ssl.conf 複製到對應文件夾下(按使用說明操做)
2.其它選項菜單——php擴展及設置——php_openssl[勾選上]
3.重啓phpstudy
==附件2:2018版本php的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\PHPTutorial\WWW" ServerName 127.0.0.1 ServerAlias 127.0.0.1 <Directory "D:\phpStudy\PHPTutorial\WWW"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> SSLEngine on SSLCertificateFile "D:\phpStudy\PHPTutorial\Apache\conf\ssl\server.crt" SSLCertificateKeyFile "D:\phpStudy\PHPTutorial\Apache\conf\ssl\server.key" </VirtualHost>