creating .pem file for ssl use

When I create an ssl-cert I sometimes do it like this:
(assuming that /etc/apache2/ssl is an existing directory)

# openssl req -new -x509 -newkey rsa:4096 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem

Generating a 4096 bit RSA private key
……………………………………………………………………………………………………++
………………………………….++
writing new private key to ‚/etc/apache2/ssl/apache.pem‘
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‚.‘, the field will be left blank.
—–
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:
Email Address []:

Then I go on with:

# ln -sf /etc/apache2/ssl/apache.pem /etc/apache2/ssl/`/usr/bin/openssl x509 -noout -hash < /etc/apache2/ssl/apache.pem`.0
# chmod 600 /etc/apache2/ssl/apache.pem

All I need to do now is to tell apache to use this file. In my case I edited /etc/apache2/sites-enabled/ssl:

NameVirtualHost *:443

SSLStrictSNIVHostCheck off

<virtualhost *:443>
ServerName www.bios-blog.com
ServerAlias bios-blog.com
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
DocumentRoot /var/www/
</virtualhost>

 

And that’s all folks…