NB: This tutorial assumes you have already installed the Apache web server (HTTPD). If not, follow the step In this section
HTTPS is an extension of the Hypertext Transfer Protocol (HTTP) used for secure communication over a computer network, typically the internet. It adds a layer of security by using encryption protocols such as Transport Layer Security (TLS) or its predecessor, Secure Sockets Layer (SSL). This encryption ensures that the data exchanged between the user's web browser and the website's server is encrypted and secure from potential eavesdroppers.
Install mod_ssl which is the tool that we will use to create the private and public keys needed or the SSL certificates.
Create the directory “ssl” and inside it create another directoy “html”. The path should be “/var/www/ssl/html”. You can create the directory anywhere on you system but make sure it is safe because it will store the private key and SSL certificate that will be generated.
Navigate to the newly created directory using “cd /var/www/ssl/html” or your own equivalent.
Navigate to the /var/www/ssl/html directory. For the purpose of this tutorial, am placing the SSL certificate in the “DocumentRoot” i.e, /var/www/ssl/html. For your own deployment, use another directory that is not exposed to the web browsers. We want to create a certificate and private key in the directory.
The command, generates a new certificate signing request (CSR) using OpenSSL. Let's break down the command:openssl req -new > key.crt
You will then be asked to enter some information that will be used in the certificate request. Enter a pass phrase, 2 letter country code, the state or province, city, organisation name, department name, hostname, email address and two extra attributes in the forms of a challenge password and an optional company name.
When you list the content of the directory with “ls”, you will see that the private key and the certificate files will be generated.
We then create the "main.cert.key" which is the unsigned certificate.
If they are generated successfully, we can then proceed to self-sign them.