LetsEncrypt is an opensource certificate authority that provides millions of websites free and trusted SSL certificates. Using its automated scripts, webmasters can encrypt traffic to and from their websites and blogs without spending a dime.
This brief tutorial is going to show you how to enable or setup LetsEncrypt certificates on Ubuntu servers for Apache2 web servers.
When setup properly, you’ll never have to purchase another SSL certificate again. Your websites and blogs will be fully SSL-enabled free of charge!
Before you can continue, lets make sure we all that’s required.
Step 1: Install Git Package on Ubuntu
One of the easier methods to get LetsEncrypt scripts installed on Ubuntu is by downloading its git repository to your system. You can only do that when you have git packages installed on Ubuntu.
Run the commands below to install Git packages on Ubuntu server.
sudo apt-get update sudo apt-get install git-all
Step 2: Downloading LetsEncrypt Scripts
Now that git is installed, go and download LetsEncrypt scripts on Ubuntu. First create a directory to store the scripts.
sudo mkdir -p /opt/letsencrypt
Then change into that directory and download the scripts
cd /opt/letsencrypt sudo git clone https://github.com/letsencrypt/letsencrypt
When the scripts are downloaded, enable the main scripts to be executable. You can do that by running the commands below.
sudo chmod g+x letsencrypt/letsencrypt-auto sudo ./letsencrypt/letsencrypt-auto --help
After running the commands above, LetsEncrypt will download and updates all scripts and packages, including missing dependencies. Wait a few minutes until all packages and scripts are updated.
Step 3: Installing LetsEncrypt SSL for Apache2
At this point, everything should be in place to install your free SSL certificate for your sites. Before running the commands below you must make sure that your website or blog is functional.
LetsEncrypt will need to verify that your site is up and that traffic is allowed to a certain directory. The easiest way is to give Apache2 full access to the site’s directory.
When all is done, run the commands below to create a free SSL certificate to protect both www and non-www part of your domain.
sudo /opt/letsencrypt/letsencrypt/letsencrypt-auto --apache --email=YOUREMAIL@YOURDOMAIN.COM -d YOURDOMAIN.COM -d WWW.YOURDOMAIN.COM
The commands above calls LetsEncrypt telling them we’re using Apache2 Webserver so that it can automate the process. The commands include our email address to contact us and the domains we want to enable SSL on.
Please make sure you have these in your Apache2 VirtualHost file for the site.
ServerName yourdomain.com ServerAlias www.yourdomain.com
LetsEncrypt will verify the domain automate the entire process by configuring Apache2 webserver and all configurations, including redirects to make the site SSL-enabled. This whole process is automated on Apache2.
When the process is done, go and check your site and it should begin communicating over SSL.
This post shows you how to use LetsEncrypt automated scripts to enable free SSL certificates for your sites running Apache2 Webserver on Ubuntu 17.04 servers. When you apply the steps above in no time you websites and blogs will be configured to communicating over SSL.
At end, if redirect wasn’t configured, please read our post on redirecting apache2.
You may also like the post below: