Nginx + Certbot
Posted in:
Uncategorized
Step:
You can use Certbot to obtain and install SSL/TLS certificates from Let’s Encrypt for your Nginx server. Here are the steps to use Certbot with Nginx on Ubuntu:
- Install Certbot:sql
sudo apt-get update sudo apt-get install certbot python3-certbot-nginx
Verify Nginx is running:
lua
sudo systemctl status nginx
Open the firewall to allow HTTP and HTTPS traffic:
python
sudo ufw allow 'Nginx Full'
Run Certbot with Nginx plugin:
css
sudo certbot --nginxThis command will prompt you to provide an email address for renewal notices and ask if you agree to the Let’s Encrypt terms of service.- Certbot will ask which domains you want to secure. Choose the appropriate domains by typing the corresponding numbers separated by commas, or enter “all” to select all domains.
- Certbot will configure SSL for your Nginx server, update the Nginx configuration file, and reload Nginx to activate the changes.
- Verify SSL is working by visiting your domain in a web browser using https://.
- Certbot will set up automatic renewal of your SSL/TLS certificates. You can verify the renewal process by running
sudo certbot renew --dry-run.
That’s it! Your Nginx server is now configured with SSL/TLS certificates from Let’s Encrypt, and Certbot will automatically renew the certificates when they are close to expiration.
References
SSL check expiration date command
openssl s_client -connect devculi.com:443 -servername example.com | openssl x509 -noout -dates