Sitemap

Member-only story

Step-by-Step Guide to Activate SSL with Certbot in NGINX

2 min readJun 14, 2024

To activate SSL effectively and easily for your Nginx server, you can use Certbot, a free tool that helps automate the process of obtaining and renewing SSL/TLS certificates from Let’s Encrypt. Here’s a step-by-step guide to do so:

Press enter or click to view image in full size
Step-by-Step Guide to Activate SSL with Certbot in NGINX
Step-by-Step Guide to Activate SSL with Certbot in NGINX

1. Install Certbot

First, you need to install Certbot and the Nginx plugin. You can do this using your package manager. For example, on Ubuntu, you can use:

sudo apt update
sudo apt install certbot python3-certbot-nginx

2. Obtain an SSL Certificate

Use Certbot to automatically obtain and install an SSL certificate for your domain. Replace website_name with your actual domain name.

sudo certbot --nginx -d website_name.com

Certbot will prompt you through the process, which includes verifying your domain ownership and automatically configuring your Nginx server to use the new certificate.

3. Configure Nginx for SSL

Certbot should automatically update your Nginx configuration. However, to ensure everything is set up correctly, your Nginx configuration file should look something like this:

server {
if ($host = website_name.com) {
return…

--

--

Chinmay Roy
Chinmay Roy

Written by Chinmay Roy

Software Engineer | Backend Python/Django Developer | Database Management, REST APIs, Nginx, Linux Expert | Follow on Medium to support.