微信小程式開發需要用到 https, 剛好本地開發 需要用到, 瞭解到 google 的mkcert
mkcert證照的連線
window10 使用 PowerShell 安裝 以管理員開啟 輸入如下命令
$ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
$ choco install mkcert
$ mkcert -install
Created a new local CA at "/Users/filippo/Library/Application Support/mkcert" ?
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! ?
$ mkcert fast.test "*.fast.test" fast.test localhost 127.0.0.1 ::1
Using the local CA at "/Users/filippo/Library/Application Support/mkcert" ✨
Created a new certificate valid for the following names ?
- "fast.test"
- "*.fast.test"
- "localhost"
- "127.0.0.1"
- "::1"
apache httpd.conf 配置
- 開啟 Include conf/extra/httpd-ssl.conf
- 在 httpd-ssl.conf 配置
<VirtualHost *:443>
DocumentRoot "D:\phpStudy\PHPTutorial\WWW\fastAdmin_test\icenter\public"
ServerName fast.test
ServerAlias
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL
#SSLCertificateFile "C:\phpStudy\Apache\conf\ssl\www.wlphp.com\2_www.wlphp.com.crt"
#SSLCertificateKeyFile "C:\phpStudy\Apache\conf\ssl\www.wlphp.com\3_www.wlphp.com.key"
#SSLCertificateChainFile "C:\phpStudy\Apache\conf\ssl\www.wlphp.com\1_root_bundle.crt"
SSLCertificateFile "D:/phpStudy/PHPTutorial/Apache/conf/ssl/fast.test+5.pem"
SSLCertificateKeyFile "D:/phpStudy/PHPTutorial/Apache/conf/ssl/fast.test+5-key.pem"
#SSLCertificateChainFile "D:/phpStudy/PHPTutorial/Apache/conf/ssl/ca-bundle.crt"
<Directory "D:\phpStudy\PHPTutorial\WWW\fastAdmin_test\icenter\public">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
上圖 成功了 一圖勝千言