Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dasgoll/5c7c02f363e7aeaff2837d650d985cc7 to your computer and use it in GitHub Desktop.
Save dasgoll/5c7c02f363e7aeaff2837d650d985cc7 to your computer and use it in GitHub Desktop.
create a self signed wildcard ssl cert for testing with nginx.conf example
openssl genrsa 2048 > edgenode1.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key edgenode1.key -subj "/C=JO/CN=*.goll.com"> edgenode1-wildcard.cert

Common Name (eg, your name or your server's hostname) []:*.goll.com

cat edgenode1-wildcard.cert edgenode1.key > edgenode1-wildcard.pem

chmod 644 edgenode1.key edgenode1-wildcard.pem

mkdir /etc/nginx/ssl
cp edgenode1.key edgenode1-wildcard.pem  /etc/nginx/ssl

vim /etc/nginx/conf.d/ssl.conf

server {
  listen 443;
	server_name *.goll.com;

	ssl                  on;
	ssl_certificate      /etc/nginx/ssl/edgenode1-wildcard.pem;
	ssl_certificate_key  /etc/nginx/ssl/edgenode1.key;
	ssl_session_timeout  5m;

}

=== or 2 files in one command:

openssl req  -subj "/C=JO/CN=*.goll.com"  -x509 -nodes -days 365  -newkey rsa:2048 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt

https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-on-centos-7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment