wampserver64本地啓用https

我本身的環境:win10,wampserver64 3.1.3,php用的7.2.4,我因爲裝了visual studio2017,vc的那些環境是有的,根據須要自行安裝環境php

首先感謝https://blog.csdn.net/haolipengzhanshen/article/details/51278262,我是參考了這篇本身進行實踐的shell

1.先打開apache的bin目錄,個人是C:\wamp64\bin\apache\apache2.4.33\bin,shift+右鍵在此處打開powershell,我是管理員帳戶因此是powershell,通常是cmd,反正都要操做cmd的,若是使用powershell打開的還要使用cmd打開cmdapache

2.輸入set OPENSSL_CONF=../conf/openssl.cnf,回車瀏覽器

3.輸入openssl genrsa 1024>server.key,回車安全

4.輸入openssl req -new -key server.key > server.csr,回車,除了Common Name均可以直接回車,這項填本身的域名,因爲我有子站點的需求,我用的是*.gcud.gcud網站

 

5.將server.crt和和server.key複製到apace的配置目錄,個人路徑是C:\wamp64\bin\apache\apache2.4.33\conf.net

6.打開apache的ssl_module和socache_shmcb_module模塊cdn

7.打開apache配置文件置文件httpd.conf,默認路徑是C:\wamp64\bin\apache\apache2.4.33\conf\nf\httpd.conf,把Include conf/extra/ra/httpd-ssl.conf前面的#去掉server

8.打開apache額外配置目錄的目錄的httpd-ssl.conf文件,默文件,默認路徑是C:\wamp64\bin\apache\apache2.4.33\conf\extra\ra\httpd-ssl.conf,將SSLCertificateFile,SSLCertificateKeyFile,SSLSessionCache,ErrorLog,TransferLog,CustomLog,改爲本身的相應路徑,看後綴應該都知道是什麼blog

9.再把DocumentRoot改爲網站所在路徑,若是隻打算弄一個https,路徑改爲項目所在就好了,ServerName改爲localhost:443,一個的話改爲本身的域名,第10能夠跳過

10.在最後加上

<VirtualHost *:443>
ServerName gcud.gcud:443
DocumentRoot "C:/wamp64/www/gcud"
SSLCertificateKeyFile "C:/wamp64/bin/apache/apache2.4.33/conf/server.key"
SSLCertificateFile "C:/wamp64/bin/apache/apache2.4.33/conf/server.crt"
</VirtualHost>
<VirtualHost *:443>
ServerName source.gcud.gcud:443
DocumentRoot "C:/wamp64/www/source.gcud.gcud"
SSLCertificateKeyFile "C:/wamp64/bin/apache/apache2.4.33/conf/server.key"
SSLCertificateFile "C:/wamp64/bin/apache/apache2.4.33/conf/server.crt"
</VirtualHost>

11.在hosts文件加入本身的域名,如
127.0.0.1 gcud.gcud

127.0.0.1 source.gcud.gcud

12.重啓apache,打開瀏覽器輸入你設定的域名,若是是不存在的根域名,要本身手動在前面加https,瀏覽器會提示不安全,本身強制去就行,另外有子站點做爲cdn的話,也要在瀏覽器裏手動將域名打開容許,不然瀏覽器會攔截

相關文章
相關標籤/搜索