本地https快速解决方案 mkcert

/ 0评 / 0

mkcert 是一个使用 go 语言编写的生成本地自签证书的小程序,具有跨平台,使用简单,支持多域名,自动信任 CA 等一系列方便的特性可供本地开发时快速创建 https 环境使用。

mac 安装

brew install mkcert

使用步骤

  1. # mkcert -install

Created a new local CA 💥
Sudo password:
The local CA is now installed in the system trust store! ⚡️


  1. # mkcert xxx.com "*.xxx.com" localhost 127.0.0.1 ::1

Created a new certificate valid for the following names 📜
"xxx.com"
"*.xxx.com"
"localhost"
"127.0.0.1"
"::1"
Reminder: X.509 wildcards only go one level deep, so this won't match a.b.xxx.com ℹ️
The certificate is at "./xxx.com+4.pem" and the key at "./xxx.com+4-key.pem" ✅
It will expire on 30 November 2025