certbot, apache,

How to secure Apache with Let's Encrypt on Rocky Linux 8

Aug 08, 2021 · 2 mins read · Post a comment
How to secure Apache with Let's Encrypt on Rocky Linux 8

As a part of the certbot installation in this tutorial, you will see how to secure your Apache web server with a free Let’s Encrypt SSL certificate. Let’s start.

Prerequisites

Generate Let’s Encrypt SSL Certificate

Step 1. Before generating a Let’s Encrypt SSL certificate, make sure that your domain is correctly pointed to your server IP address and propagated. There is an online dns tool that you can use to check it.

Step 2. Generate Let’s Encrypt certificate trough certbot:

sudo certbot --apache -d domain.com -d www.domain.com
  • certbot - this will run certbot
  • --apache - it’s a certbot plugin that we want to use it.
  • -d - specify the names that you’d like the certificate to be valid for.

Step 3. If everything is fine with the command execution, certbot will ask how you’d like to configure your HTTPS settings: Output:

Please choose whether HTTPS access is required or optional.
-------------------------------------------------------------------------------
1: Easy - Allow both HTTP and HTTPS access to these sites
2: Secure - Make all requests redirect to secure HTTPS access
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

Select your choice. Once the certificate is generated you should get the following Output:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/domain.com/fullchain.pem. Your cert will
   expire on xxxx-xx-xx. To obtain a new or tweaked version of this
   certificate in the future, simply run certbot again with the
   "certonly" option. To non-interactively renew *all* of your
   certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work

The above output means that you have successfully generated SSL for your domain.

Step 4. You need to restart the Apache:

sudo systemctl restart httpd

Now open your desired web browser and notice the green lock icon.

Conclusion

This tutorial shows you how to secure Apache web server with Let’s Encrypt free SSL certificate. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.