letsencrypt nginx code example
Example 1: how to secure letsencrypt on ubuntu 20.04 with nginx
sudo apt install certbot python3-certbot-nginx
Example 2: nginx certbot ubuntu
// Ubuntu 20.04
sudo apt install certbot python3-certbot-nginx
// Ubuntu 18.04
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
// Configure ufw
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
sudo ufw delete allow 'Nginx HTTPS'
sudo certbot --nginx -d example.com
Example 3: lets encrypt nginx
sudo certbot --nginx -d example.com -d www.example.com
Example 4: letsencrypt auto renew nginx
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root certbot -q renew --nginx
Example 5: nginx letsencrypt
sudo certbot renew
sudo service nginx restart