We have seen How to install Let’s Encrypt on CentOS 7 with Apache . Now we will see How to install Let’s Encrypt on CentOS 7 with Nginx.

# yum install epel-release 
# yum update -y

You will also need to have nginx installed and running.

Install Let’s Encrypt Client

# yum install certbot python2-certbot-nginx

Obtaining a Certificate

# certbot --nginx -d testdomain.com 

Configuring automatic certificate renewal

Let’s encrypt certificates are valid for 90 days. It is recommended to renew it within 60 days, in order to avoid any problems. To achieve this, certbot will assist us with your renewal command. It will verify that the certificate is less than 30 days from expiration:

# certbot renew

If the installed certificate is recent, certbot will only verify its expiration date:

Processing  /etc/letsencrypt/renewal/testdomain.com.conf
The following certs are not due for renewal yet:
    /etc/letsencrypt/live/testdomain.com/fullchain.pem (skipped)
No renewals were attempted.

To automate this renewal process, you can set up a cronjob :

# crontab -e
* */12 * * * /usr/bin/certbot renew >/dev/null 2>&1

Now you should have successfully installed and configured Let’s Encrypt with Apache.