To set up Apache with Let’s Encrypt Certificates on CentOS 8/9, you can follow these steps:
- Install the certbot-apache package using the command:
sudo dnf install certbot-apache
- Run the command to obtain the SSL certificate:
sudo certbot --authenticator apache -installer apache
- Follow the prompts to enter your email address and agree to the terms of service.
- Select the correct webroot path for your Apache installation.
- Once the SSL certificate is obtained, the certbot will automatically configure the Apache virtual host files to use the new certificate.
- Verify the SSL certificate is in place by running the command:
sudo certbot certificates
- The SSL certificate will be automatically renewed by certbot, but you can also run the command manually:
sudo certbot renew --dry-run
- Restart Apache for the changes to take effect:
sudo systemctl restart httpd
Note: Make sure you have the mod_ssl module enabled in Apache, before configuring with Let’s Encrypt.