Let’s Encrypt is a free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG).
In this tutorial, we will explain how to secure Apache with a free Let’s encrypt SSL certificate on Ubuntu 18.04.
Make sure your system meets the following minimum requirements before continue with this tutorial:
- You must have an account with sudo privileges and make sure your Ubuntu 18.04 server can access the Internet.
- The Apache 2.x (with mod_rewrite) web server have installed on your Ubuntu 18.04 server.
- PHP 7.1 or higher installed on your Ubuntu 18.04 server.
Step 1, Install Cerbot
Certbot is a fully featured and easy to use tool that can automate the tasks for obtaining and renewing Let’s Encrypt SSL certificates and configuring web servers. The certbot package is included in the default Ubuntu repositories.
Update the packages list and install the certbot package:
sudo apt update sudo apt install certbot python-certbot-apache
Step 2,Install Cerbot Apache plugin
Certbot has an Apache plugin, which is supported on many platforms, and automates certificate installation.
sudo certbot --apache
Running this command will get a certificate for you and have Certbot edit your Apache configuration automatically to serve it. If you’re feeling more conservative and would like to make the changes to your Apache configuration by hand, you can use the
sudo certbot --apache certonly
Step 3,Automating renewal
The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let’s Encrypt certificates last for 90 days, it’s highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
If there are no errors, it means that the renewal process was successful.
Step 4, Reload apache2 server
Reload the Apache service for changes to take effect:
sudo systemctl reload apache2
That’s It! In this tutorial, we have explained how to Secure Apache with Let`t Encrypt on Ubuntu 18.04. If you have any questions or thoughts to share, don’t forget to leave a comment to reach us.
If you want to learn more about how to use Certbot, their documentation is a good starting point.