Multi-Domain SSL Setup with “Subject Alternative Names”
Here’s how to create a cert/csr with more than one domain name.
First you’ll want to create the directory.
I use NGiNX so I like to put my certs in
/etc/nginx/ssl, but you can put yours anywhere
So now we will create the directory
Now we will cd into the directory
Now we will paste the following in the
[req] default_bits = 4096 prompt = no default_md = sha256 req_extensions = req_ext distinguished_name = dn [ dn ] C=US ST=YOURstateHERE L=YOURcityHERE O=YOURorgNAMEhere CN = YOURmainDOMAINhere [ req_ext ] subjectAltName = @alt_names [ alt_names ] DNS.1 = YOURmainDOMAINhere DNS.2 = YOURaltDOMAINhere
Now we will create the key and csr
I like to create simple files like key and csr and crt since I keep the domain files in their own directory
openssl genrsa -out key 4096
openssl req -new -key key -out csr -config sslConfig.txt
Now this will give you the key and csr. Now you view the csr using cat
You can then paste this data into the page where you’re getting your SSL cert from
I recommend using acme.sh for LetsEncrypt as it’s automatic and very easy AND FREE. You can find that HERE.