广告位
mkcert生产本地HTTPS加密证书的工具
作者: 分类:前端开发浏览(3,998)2018-7-3

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 restart)! 

$ mkcert example.com '*.example.org' myapp.dev 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 
 - "example.com"
 - "*.example.org"
 - "myapp.dev"
 - "localhost"
 - "127.0.0.1"
 - "::1"

The certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅

使用来自真实CA的证书进行开发可能是危险的或不可能的(对于诸如localhost或的主机127.0.0.1),但自签名证书会导致信任错误。管理自己的CA是最好的解决方案,但通常涉及到神秘的命令,专业知识和手动步骤。

mkcert自动在系统根存储中创建并安装本地CA,并生成本地信任的证书。

安装

在macOS上,使用Homebrew。

brew install --HEAD https://github.com/FiloSottile/mkcert/raw/master/HomebrewFormula/mkcert.rb
brew install nss # if you use Firefox

在Linux上(-install支持即将推出!),使用预先构建的二进制文件(再次提供),或从源代码构建(需要Go 1.10+)。

$ git clone https://github.com/FiloSottile/mkcert
$ cd mkcert && make

接下来会支持Windows。

 

来源:https://github.com/FiloSottile/mkcert
图片压缩在线工具 tools online