Securing Apache Server Using (Let’s Encrypt) [Ubuntu]

Last Updated on: 

In this guide, you’ll learn how to use secure your Apache server for free with Let’s Encrypt, this way, you can ensure your websites are encrypted and available over HTTPS.

Let’s Encrypt provide free SSL/TLS certificates. You can get a valid SSL certificate for your domain at no cost. These certificates can be used in a production environment as well.

Note: Let’s Encrypt do a DNS check for the domain, that domain is pointed to the current server. After that it issues a certificate for the domain, so, it won’t work for local development, although there is another approach for that, e.g Securing Apache Server Using a (Self Signed Certificate) [Ubuntu].

First, install certbot-auto, and save it under /usr/sbin directory, the cerbot-auto is a Let’s Encrypt client, it is used to automatically enable HTTPS on your website with EFF’s Certbot, deploying Let’s Encrypt certificates.

Use the following command to download it:

					

sudo wget https://dl.eff.org/certbot-auto -O /usr/sbin/certbot-auto
sudo chmod a+x /usr/sbin/certbot-auto

The next step is to get an SSL certificate, use the following command to do that:

					

sudo certbot-auto certonly --standalone -d website.com  -d www.website.com

This would do a strong Domain Validation automatically with multiple challenges to verify the ownership of the domain. Once the Certificate Authority (CA) verified the authenticity of your domain, the SSL certificate will be issued.

You will be prompted for an email address, which is used for sending email alerts related to SSL renewal and expiration. Also, asks a few more questions. After completion, it will issue an SSL certificate and will also create a new VirtualHost configuration file on your server.

View the issued certificate under:

					

/etc/letsencrypt/live/website.com

The final step is to change it in your virtual host, so, in Apache:

					

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/website.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/website.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/website.com/chain.pem

Comment policy: Respectful and beneficial comments are welcome with full open hands. However, all comments are manually moderated and those that doesn't relate with what the passage is saying or offensive comments would be deleted. Thanks for understanding!

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php