In this guide, we will explain how to Secure Apache with Let's Encrypt on CentOS 7.

Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.

Once you have signed up, log into your Cloudwafer Client Area and deploy your Cloudwafer cloud server.

Step 1 — Install Prerequisites
We need to install the Apache web server, the mod_ssl module to correctly serve encrypted traffic and lastly enable the EPEL repository, which provides additional packages for CentOS, including the certbot package we need.

Enable the EPEL repository by issuing the command below:

sudo yum install epel-release

Next, install all the required packages by issuing the command below:

sudo yum install httpd mod_ssl python-certbot-apache

Step 2: Check Status of Apache Web Server
We need to ensure Apache is running on our server and is accessible to the outside world before proceeding to request a certificate. To check the status of Apache, issue the command below:

sudo systemctl status httpd

If it's not running, issue the command below to start Apache:

systemctl start httpd

Step 3: Request an SSL Certificate from Let's Encrypt
After confirming that Apache is running without errors on our server, we can request an SSL certificate for our domain.

Issue the command below to request for an SSL Certificate. In this guide, our domain is:

sudo certbot --apache -d -d

A step-by-step guide to customize your certificate options would be presented to you as shown below.

First, you need to type A to agree to the terms:

Next, you will be prompted if you are willing to share your email address with the Electronic Frontier Foundation. You can choose not to:

Next, the process for obtaining a new certificate begins for the domains selected:

Lastly, you will be prompted to choose whether or not to redirect HTTP traffic to HTTPs removing HTTP access. Press 1 for No redirect and 2 for Redirect:

After all the above steps are completed without errors, a congratulations message is displayed informing that you have successfully enabled SSL on your domains.

Read about why you should Enable SSL on your website here