在windows10上使用巧克力来安装mkcert
以下代码写开install.cmd中,用管理员权限运行
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install mkcert -y
mkcert -install
安装过程中会提示,确定即可
安装完成后,就可以生成证书了
del /f /s /q *.pem
rem 生成
mkcert localhost.com "*.localhost.com"
以上代码,会生成一个localhost相关的证书,生成即可使用