You can set up a free SSL certificate from Let’s Encrypt to use with Apache by following these steps:
-
Install Certbot:
sqlsudo apt-get update sudo apt-get install certbot
-
Obtain a certificate:
csssudo certbot certonly --webroot --webroot-path /var/www/html -d example.com
Replace
example.com
with your own domain name. -
Update Apache virtual host:
bashsudo nano /etc/apache2/sites-available/example.com.conf
Add the following lines inside the VirtualHost block:
bashSSLEngine on SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
Save and exit the file.
-
Test Apache configuration:
sudo apachectl configtest
If the output is “Syntax OK,” restart Apache:
sudo systemctl restart apache2
Your Apache server should now be configured to use the Let’s Encrypt SSL certificate. You can test it by visiting https://example.com
in a web browser.