how to configure Letsencrypt for nginx on Ubuntu 18.04

Hello Techrunnr readers, this document shows you how to configure Letsencrypt for nginx on Ubuntu 18.04.
Letsencrypt is a free SSL certificate service provider, where you can get SSL certificate for your websites, blog, etc. Letsencrypt issues SSL certificate for 90 days, a task scheduler verifies the expiry date and reissue new certificate before it gets expired.

So, Let’s start the configuration

Let’s say you have 2 sites test.com and example.com and you have two separate files for virtual hosting,

The sample configuration files look like this,

Now we install Letsencrypt in ubuntu server by executing the following commands,

sudo apt-get update
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install -y python-certbot-nginx

Setup the certificates & convert Virtual Hosts to HTTPS:

sudo certbot –nginx

It will ask for:

* an email address
* agreeing to its Terms of Service
* which domains to use HTTPS for (it detects the list using server_name lines in your Nginx config)
* whether to redirect HTTP to HTTPS (recommended) or not
* You could stop here if all you want is HTTPS as this already gives you an A rating and maintains itself.

Test your site with SSL Labs using https://www.ssllabs.com/ssltest/analyze.html?d=www.YOUR-DOMAIN.com

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

0 Comments

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.