← 返回命令列表

Linux command

mkcert 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Install local CA

mkcert -install

Generate certificate

mkcert [localhost]

Multiple domains

mkcert [localhost] [127.0.0.1] [::1]

Wildcard certificate

mkcert [*.local.dev]

Specify output names

mkcert -key-file [key.pem] -cert-file [cert.pem] [localhost]

Generate a PKCS#12 bundle

mkcert -pkcs12 [example.test]

Show CA root directory

mkcert -CAROOT

Uninstall CA

mkcert -uninstall

说明

mkcert creates locally-trusted certificates. It simplifies HTTPS for development. The tool installs a local CA and generates trusted certificates. No browser warnings.

参数

-install
Install local CA.
-uninstall
Uninstall local CA.
-key-file _FILE_
Key output file.
-cert-file _FILE_
Certificate output file.
-p12-file _FILE_
PKCS#12 output file (used with -pkcs12).
-pkcs12
Produce a ".p12"/".pfx" file with certificate and key (for Java/legacy tools).
-client
Generate a certificate for client authentication.
-ecdsa
Use ECDSA keys instead of RSA.
-csr _CSR_
Generate a certificate based on the supplied CSR.
-CAROOT
Print the CA certificate and key storage location.
--help
Display help information.

FAQ

What is the mkcert command used for?

mkcert creates locally-trusted certificates. It simplifies HTTPS for development. The tool installs a local CA and generates trusted certificates. No browser warnings.

How do I run a basic mkcert example?

Run `mkcert -install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -install do in mkcert?

Install local CA.