Self signed certificate for nginx with openssl

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

And fill fields. Common Name (CN) should be the domain you want to use.

This will create cert_dev.crt and cert_dev.key

Use in Nginx config:

listen 443 ssl; 
ssl_certificate path_to/cert_dev.crt; 
ssl_certificate_key path_to/cert_dev.key;

another way to generate

mkdir -p folder
openssl genrsa -out folder/site.key 2048
openssl req -new -key folder/site.key -out folder/site.csr
openssl x509 -req -days 1000 -in folder/site.csr -signkey folder/site.key -out folder/site.crt
#ssl #nginx
Ivan Borshchov profile picture
Dec 27, 2016
by Ivan Borshchov
Did it help you?
Yes !

Best related