Securing your website is essential in today's digital world. Using Let's Encrypt with Apache on a CentOS server provides a free and reliable way to implement SSL/TLS encryption, ensuring data privacy and security for your visitors. This guide walks you through the process step-by-step.

Prerequisites

  • A CentOS server with root access
  • Apache installed and running
  • Domain name pointed to your server's IP address
  • Firewall configured to allow HTTP (80) and HTTPS (443) traffic

Installing Certbot

Certbot is the recommended tool for obtaining and renewing Let's Encrypt certificates. To install Certbot on CentOS, run the following commands:

For CentOS 7:

sudo yum install epel-release

sudo yum install certbot python2-certbot-apache

For CentOS 8:

sudo dnf install epel-release

sudo dnf install certbot python3-certbot-apache

Obtaining and Installing the SSL Certificate

Once Certbot is installed, you can obtain your SSL certificate by running:

sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

This command will automatically configure Apache to use the new certificate. Follow the prompts to complete the process.

Verifying the SSL Installation

After installation, verify that your website is accessible via HTTPS. Visit https://yourdomain.com in your browser. You should see a padlock icon indicating a secure connection.

Renewing Your SSL Certificate

Let's Encrypt certificates are valid for 90 days. Certbot sets up automatic renewal by default. To test renewal, run:

sudo certbot renew --dry-run

Additional Tips

  • Ensure your server's firewall allows traffic on ports 80 and 443.
  • Regularly update Certbot and your server to maintain security.
  • Backup your server configuration before making changes.

By following these steps, you can secure your website with Let's Encrypt on a CentOS server using Apache. This setup helps protect your visitors' data and improves your site's trustworthiness.