To configure Apache to use a free SSL certificate from Let's Encrypt, follow these steps:
- Install the Let's Encrypt client.
sudo apt-get install certbot
- Generate a certificate signing request (CSR).
sudo certbot certonly --apache
This will generate a CSR and private key for your domain.
- Obtain a certificate from Let's Encrypt.
sudo certbot certonly --apache --agree-tos
This will request a certificate from Let's Encrypt and install it on your server.
- Configure Apache to use the SSL certificate.
Edit the Apache configuration file for your website (usually located at /etc/apache2/sites-available/your_domain_name.conf) and add the following directives:
SSLCertificateFile /etc/letsencrypt/live/your_domain_name/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your_domain_name/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/your_domain_name/chain.pem
- Enable SSL and restart Apache.
sudo a2enmod ssl
sudo systemctl restart apache2
Your website should now be accessible over HTTPS.
You can test your SSL certificate by visiting your website in a web browser. You should see a padlock icon in the address bar of the browser, indicating that the website is using a secure connection.
Note: You will need to renew your Let's Encrypt certificate every 90 days. You can do this by running the following command:
sudo certbot renew --apache
This will automatically renew your certificate and install it on your server.