Certbot is a command-line tool that can be used to obtain and manage SSL/TLS certificates for your website. In order to use Certbot with Nginx on Ubuntu, you can follow these steps:
Install Certbot:
sudo apt-get update
sudo apt-get install certbot
Install the Nginx plugin for Certbot:
sudo apt-get install python3-certbot-nginx
Verify that your Nginx server blocks are set up correctly by running:
sudo nginx -t
If the configuration test passes, reload Nginx:
sudo systemctl reload nginx
Use Certbot to obtain a new SSL/TLS certificate for your domain:
sudo certbot --nginx -d example.com -d www.example.com
Replace example.com and www.example.com with your actual domain name(s).
Certbot will guide you through the process of obtaining a new SSL/TLS certificate. You will be prompted to enter your email address and agree to the terms of service. Certbot will then communicate with Let's Encrypt to obtain and install the certificate.
Once the certificate is installed, Certbot will update your Nginx configuration to use HTTPS. You can verify this by running:
sudo nginx -t
If the configuration test passes, reload Nginx:
sudo systemctl reload nginx
Congratulations, your Nginx server should now be configured to use HTTPS with a valid SSL/TLS certificate!
Top comments (0)