SSL Configuration on Linux RHEL
hariselva | Feb. 7, 2020, 2:45 a.m.

This Tutorial helps to configure SSL on the RHEL server.

Generate CSR and KEY file:

openssl req -new -newkey rsa:2048 -nodes -out yourdomain.csr -keyout yourdomain.key -subj “/C=US/ST=New York/L=<Location>/O=<Organisation>/OU=<Out>-QA/CN=<connection url>”

Help Generate Certificate

Instructions:

Learn More:

In the Server, run as a root user

sudo yum install mod_ssl

This will generate a new file ssl.conf in /etc/httpd/conf.d

Command also generates localhost.crt (/etc/pki/tls/certs/) and localhost.key (/etc/pki/tls/private/)

Move the files to backup

Copy the digitally signed .crt to /etc/pki/tls/certs/ folder and .key to /etc/pki/tls/private/ folder

Open ssl.conf using default editor and delete the lines between VirtualHost tags

 

Add the below lines,

<VirtualHost *:443>
DocumentRoot “/var/www/html”
ServerName http://www.yourdomain.com
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/yourdomain.crt
SSLCertificateKeyFile /etc/pki/tls/private/yourdomain.key
SSLCertificateChainFile /etc/pki/tls/certs/DigiCertCA.crt
</VirtualHost>

Now restart the server using “systemctl restart httpd” command. You are all set.

 

Verification:

openssl s_client -showcerts -connect yourdomain:443

 

Redirect http to https:

Go to ssl.conf file and add the below lines

<VirtualHost *:80>
ServerName qaportal.alticeusa.com
Redirect / https://qaportal.alticeusa.com
</VirtualHost>

Restart the server using “systemctl restart httpd” command.

By entering url http://yourdomain.com, page will redirect to https://yourdomain.com