mkcert
mkcert 是一个用于创建本地信任的开发证书的简单工具,无需任何配置。
$ mkcert -install
Created a new local CA 💥
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 example.com "*.example.com" example.test localhost 127.0.0.1 ::1
Created a new certificate valid for the following names 📜
- "example.com"
- "*.example.com"
- "example.test"
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅
使用来自真实证书颁发机构 (CA) 的证书进行开发可能很危险,甚至无法实现(例如example.test
、localhost
或 等主机127.0.0.1
),但自签名证书会导致信任错误。管理自己的 CA 是最佳解决方案,但通常需要复杂的命令、专业知识和手动步骤。
mkcert 自动在系统中创建并安装本地 CA...