/ Deployment / (Rails + Passenger) How To Secure Nginx with Let’s Encrypt on Ubuntu 18.04

This guide will show you how to install SSL Certificate with Let’s Encrypt on Ubuntu server 18.04 that uses Rails with Nginx and Passenger.

Step 1 — Installing Certbot

Add the repository

$ sudo add-apt-repository ppa:certbot/certbot

Install Certbot’s Nginx package with apt:

$ sudo apt install python-certbot-nginx

Step 2 — Obtaining and Installing SSL Certificate

$ sudo certbot --nginx -d example.com -d www.example.com

If you also setup your domain to handle www, use the command below instead:

$ sudo certbot --nginx -d example.com -d www.example.com

If this is your first time running certbot, you will be prompted to enter an email address and agree to the terms of service. After doing so, certbot will communicate with the Let’s Encrypt server, then run a challenge to verify that you control the domain you’re requesting a certificate for.

If that’s successful, certbot will ask how you’d like to configure your HTTPS settings:

https

That’s it! Enjoy 😊

No video for this post.

No issues for this post.

by ryzalyusoff