This is my interpretation on setting up a self-signed SSL certificate for an Apache web-server.
The instructions are generic and apply to most versions of Apache on almost any Linux platform.
Firstly, I suggest creating a separate directory to store your SSL certificates e.g.
Now lets browse to the directory we just created:
We are using the ‘openssl‘ utility to generate our SSL certificate.
Firstly, we create a private key** using:
openssl genrsa -out mydomain.key
Now we generate a certificate signing request or CSR for short using:
openssl rsa -in mydomain.key -out mydomain.csr
Fill in the appropriate fields with relative information….
and, finally create the self-signed certificate using:
openssl x509 -req days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
This creates a selfsigned ‘mydomain.crt’ for 365 days.
**For safety only allow root to read the private key using:
chown root mydomain.key && chmod 600 mydomain.key