HTTPS, Setting up an SSL on RHEL/Centos Web Server.

If you haven't installed mod_ssl and openssl yet, install it.

$ yum install mod_ssl openssl

Generate both the certificate and key using the command below:

$ openssl req -x509 -days 7100 -nodes -newkey rsa:4096 -keyout apachekey.key -out apachekey.crt

Then copy both generated files to /etc/pki/tls/certs/

$ cp apachekey.* /etc/pki/tls/certs/

Specify the SSL certificate and key path on the httpd configuration file.

$ vim /etc/httpd/conf/httpd.conf

...sample httpd.conf file.

..VirtualHost *:443...
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/apachekey.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/apachekey.key