openssl genrsa -des3 -out server.key 4096cp server.key server.key.origopenssl rsa -in server.key.orig -out server.keyopenssl req -new -key server.key -out server.csrOption B (required for multiple domains)
yourdomain.com.certdetailsinsert contents and replace and add where necessary:
[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=(two letter country code)
ST=(Full state name)
L=(full city name)
O=(full organization name)
OU=(organizational unit)
emailAddress=(existing email address)
CN = www.your-new-domain.com
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = your-new-domain.com
DNS.2 = www.your-new-domain.com
openssl req -new -sha256 -nodes -out yourdomain.com.csr -newkey rsa:2048 -keyout yourdomain.com.key -config <( cat yourdomain.com.certdetails )
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crtchmod 600 server.*mkdir -p /etc/apache2/sslcp server.crt /etc/apache2/ssl/site.crtcp server.key /etc/apache2/ssl/site.key<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /***/path
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /***/path
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
SSLCertificateFile /***/path
SSLCertificateKeyFile /***/path
<Location /> # this section appears to be optional?
SSLRequireSSL On
# SSLVerifyClient optional # this will present a certificate selection window to the client
# SSLVerifyDepth 1
SSLOptions +StdEnvVars +StrictRequire #this appears to be optional?
</Location>
</VirtualHost>
a2enmod sslservice apache2 restartthis document last modified: October 06 2017 21:42