Command line tool to create self signed SSL certificate
NOTE! This only works on MAC! Based on the following amazing GIST.
In the folder of your project use the NPM executer:
npx create-ssl-certificate
This will create a certificate for the domain: FOLDER_NAME.dev and any subdomain.
npx create-ssl-certificate --hostname myproject
This will create a certificate for the domain: myproject.dev and any subdomain.
npx create-ssl-certificate --hostname myproject --domain test
This will create a certificate for the domain: myproject.test and any subdomain.
You will need to install dnsmasq which will route your domain to localhost. You can install it via homebrew.
brew install dnsmasq
Note! Make sure you follow the instructions to start the service when your mac boots up.
To route all domain lookups to localhost you will have to add configuration.
Replace dev
in both echo commands if you chose a different domain.
mkdir -pv $(brew --prefix)/etc
sudo mkdir -pv /etc/resolver
echo "address=/.dev/127.0.0.1" | sudo tee -a $(brew --prefix)/etc/dnsmasq.conf
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/dev