nginx ssl letsencrypt code example

Example 1: ubuntu certbot nginx

sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com

Example 2: lets encrypt nginx

#Once you have installed CertBot and Lets Encyrypt, 
#and you have set up your server blocks, 
#you will be able to run the below script in your terminal
sudo certbot --nginx -d example.com -d www.example.com

Example 3: nginx letsencrypt

sudo certbot renew
sudo service nginx restart

Example 4: how to renew let's encrypt certificate nginx

sudo certbot renew --nginx