📜 Create local self-signed certificate

👋 FYI, this note is over 6 months old. Some of the content may be out of date.
On this page

Use mkcert Jump to heading

https://github.com/FiloSottile/mkcert

Install Jump to heading

brew install mkcert
brew install nss
mkcert -install
$ mkcert -install
Created a new local CA at "/Users/zander/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 browser restart)! 🦊

Run Jump to heading

mkcert localhost 127.0.0.1 ::1
$ mkcert localhost 127.0.0.1 ::1
Using the local CA at "/Users/zander/Library/Application Support/mkcert"

Created a new certificate valid for the following names 📜
- "localhost"
- "127.0.0.1"
- "::1"

The certificate is at "./localhost+2.pem" and the key at "./localhost+2-key.pem"

This will add the certificate and key into whichever directory you ran the script in

Use openssl Jump to heading

Run this then follow the instructions.

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./server.key -out ./server.crt

This is not nearly as good as mkcert though.


← Back home