Skip to content

Instantly share code, notes, and snippets.

@lucymtc
Created December 12, 2017 22:32
Show Gist options
  • Select an option

  • Save lucymtc/78306981bce5f04e4b362546b53939e8 to your computer and use it in GitHub Desktop.

Select an option

Save lucymtc/78306981bce5f04e4b362546b53939e8 to your computer and use it in GitHub Desktop.
Creating CA-Signed Certificates for Dev Sites
// Run in the Terminal
-----------------------------------------------
$ openssl genrsa -out mysite.dev.key 2048
$ openssl req -new -key mysite.dev.key -out mysite.dev.csr
-----------------------------------------------
Answer questions after this last command
Then:
Create a mysite.dev.ext
And copy the following.
-----------------------------------------------
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = mysite.dev
DNS.2 = mysite.dev.192.168.1.19.xip.io
-----------------------------------------------
// Run in the Terminal
-----------------------------------------------
openssl x509 -req -in mysite.dev.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial \
-out mysite.dev.crt -days 1825 -sha256 -extfile mysite.dev.ext
-----------------------------------------------
Paste private key pass phrase
with VVV:
$ vagrant ssh
$ cd /etc/nginx/custom-sites && ls -ahl
$ sudo nano mysite.conf
Paste at the end, before closing brackets, (also out of ssh paste in vagrant/config/nginx-config/sites/mysite.conf):
-----------------------------------------------
ssl on;
ssl_certificate /srv/config/nginx-config/sites/ssl/mysite.dev.crt;
ssl_certificate_key /srv/config/nginx-config/sites/ssl/mysite.dev.key;
-----------------------------------------------
Then Run:
$ sudo service nginx reload
DONE!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment