Tips and tricks
How to generate ssl certificate for localhost
… or self generate ssl certificate
First, we need to create this configuration in your ~/Certificates
[req]
default_bits = 1024
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
[v3_req]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
then, enter
sudo openssl
you can write these commands:
genrsa -out /Users/raduh/Certificates/dzsvideogallery.key 2048
rsa -in /Users/raduh/Certificates/dzsvideogallery.key -out /Users/raduh/Certificates/dzsvideogallery.key.rsa
req -new -key /Users/raduh/Certificates/dzsvideogallery.key.rsa -subj /CN=dzsvideogallery.me -out /Users/raduh/Certificates/dzsvideogallery.csr -config /Users/raduh/Certificates/localhost.conf
x509 -req -extensions v3_req -days 3650 -in /Users/raduh/Certificates/dzsvideogallery.csr -signkey /Users/raduh/Certificates/dzsvideogallery.key.rsa -out /Users/raduh/Certificates/dzsvideogallery.crt -extfile /Users/raduh/Certificates/localhost.conf
then, exit and enter:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /Users/raduh/Certificates/dzsvideogallery.crt
you can then add it to your nginx.conf