Nginx + Certbot on Ubuntu
This tutorial guides users on Ubuntu how to secure their websites with HTTPS. It demonstrates installing Certbot, which utilizes Let’s Encrypt, and configuring Nginx to automatically obtain and deploy SSL certificates. Following the steps, users can enable HTTPS and configure their firewall for secure connections.
generated by
gemma3:4b
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.