Self signed SSL Certificate – Apache

In order to create a self signed certificate for a Linux server that runs apache you must first create the required public and private keys. You can easily do that using openssl package.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -out mysitename.crt

As a next step you should edit /etc/httpd/conf.d/ssl.conf file and include the new self signed certificate files. Keep in mind that files should be copied in the requested directories.

SSLCertificateFile /etc/pki/tls/certs/
SSLCertificateKeyFile /etc/pki/tls/private/mysitename.key

Lastly you can validate your certificate correctness by following my relevant article