Nginx + Certbot on Ubuntu
Fahim can secure a website with HTTPS using Certbot, which issues free Let's Encrypt certificates. This guide outlines the installation of Certbot on Ubuntu with Nginx. Key steps include updating apt, adding repositories, installing Certbot and Python-Certbot-Nginx, configuring Nginx server blocks for domain and subdomains, running `certbot --nginx` to integrate certificate locations, and enabling HTTPS through the firewall with `sudo ufw allow 'Nginx Full'`.
generated by granite3.2:8b
Automatically enable HTTPS on your website with EFF’s Certbot, deploying Let’s Encrypt certificates. This tutorial shows you how to install Certbot w/ Nginx on Ubuntu.
Table of Contents
To install certbot
sudo apt-get updatesudo apt-get install software-properties-commonsudo add-apt-repository universesudo add-apt-repository ppa:certbot/certbotsudo apt-get updatesudo apt-get install certbot python-certbot-nginx
Add/Update your server block
Make sure your Nginx server blocks match your domain+subdomains:
server_name example.com www.example.com;
If not, edit your Nginx config:
vi /etc/nginx/sites-available/default
And then restart your Nginx server:
sudo service nginx restart
Add certificate
Running this command will go through your Nginx config and add certificate locations to appropriate blocks:
sudo certbot --nginx
Allow HTTPS through the firewall:
sudo ufw allow 'Nginx Full'
Related snippets
- Can’t Redeem DOOM: The Dark Ages in NVIDIA App? Try This Quick Fix May 13, 2025 Trouble claiming DOOM: The Dark Ages in the NVIDIA app? Follow this quick network fix that solves the redemption glitch in minutes.
- Custom Scrollbar Selectors January 23, 2024 Customize scrollbar styles to perfectly match your unique aesthetic.