Would you like to learn how to install the Let’s Encrypt certificate on the Apache server of a computer running Ubuntu Linux? In this tutorial, we are going to show you how to install the Let’s Encrypt client and configure an HTTPS website on the Apache server.
• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Apache 2.4.41
In our example, the IP address of the Apache server is 36.160.86.106.
In our example, we are going to create the website: WWW.GAMEKING.TIPS.
Copyright © 2018-2021 by Techexpert.tips.
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the publisher.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Apache – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Apache.
Apache Let’s Encrypt – DNS configuration
Access the GODADDY website and purchase a DNS domain.
In our example, we purchased a domain named:
You can use any website to purchase a DNS domain, GoDaddy is just my personal choice.
Create a DNS entry pointing your website to the computer running Apache.
In our example, we created a DNS entry pointing WWW.GAMEKING.TIPS to 35.160.86.106.
Use the NSLOOKUP command to test your DNS configuration.
Here is the command output.
Congratulations! You have finished the required DNS configuration.
Tutorial Let’s Encrypt – Apache installation
Install the Apache server and the required packages.
Enable Apache module named: Mod_ssl.
Enable Apache module named: Mod_rewrite.
Edit the Apache configuration file.
Add the following lines at the end of this file.
Create directories to store the new website files and logs.
The website files will be stored inside the following directory:
The website logs will be stored inside the following directory:
Create an Apache configuration file for the new website.
Here is the file with our configuration.
Enable the new website.
Restart the Apache service.
Open your browser and try to access the HTTP version of the website.
In our example, the following URL was entered in the Browser:
• http://www.gameking.tips
You have finished the virtual host configuration on the Apache server.
Apache Let’s Encrypt – Installing the Certificate
We need to install the free HTTPS certificate.
We also need to redirect all HTTP traffic to the HTTPS version of the website automatically.
Install the list of required packages.
Install the Apache free HTTPS certificate
• Press (A) to Agree with the Terms of Service.
• Press (Y) to share your e-mail and receive Newsletters.
• Press (2) to automatically redirect your HTTP website to the HTTPS versions.
The system will automatically install a free certificate.
It will also configure the Apache server to redirect all HTTP access to the HTTPS version of your website.
In our example, the system created a virtual host configuration file.
Here is the file content.
The KEY file contains your Certificate private key and must be kept in a safe place all the time.
In our example, the KEY file was stored at :
The system automatically modifies the original Apache’s virtual host configuration file.
It will automatically redirect all HTTP requests to the HTTPS version of your website.
Open your browser and enter the DNS address of the new website using the HTTPS protocol.
In our example, the following URL was entered in the Browser:
• https://www.gameking.tips/
The HTTPS page should be presented.
Verify the certificate properties.
You have installed a Let’s Encrypt certificate on the Apache server.
Apache Let’s Encrypt – Certificate Renew
The free certificate installed is valid for 90 days.
The System creates a scheduled task to automatically renew any certificate within thirty days of expiration.
The scheduled task name is CERTBOT and it is located inside the following directory:
Here is the file content.
Use the following command to simulate the process of certificate renew.
Here is the command output.
Congratulations! You have configured the Let’s Encrypt automatic certificate renew.