Current location - Quotes Website - Signature design - How to deploy encryption certificate on Nginx
How to deploy encryption certificate on Nginx
First, install certbot.

$ sudo yum install epel- release

$ sudo yum installs certificate robot

Second, apply for a certificate for the domain name

-w followed by the site root directory.

-d is followed by the site domain name. If there are multiple domain names, you can use multiple -d parameters, each parameter is a domain name, and the -d is separated by spaces.

Certbot certonly-webroot-w site root directory -d site domain name

Prompt for email addresses for emergency notification and key recovery.

Read the document and choose Agree.

If successful, the certificate and private key will be saved in /etc/letsencrypt/live/ site domain name/

Three. Nginx configuration certificate SSL _ certificate/etc/lets encrypt/live/site domain name/fullchain.pem;

Ssl _ certificate _ key/etc/lets encrypt/live/site domain name/privkey.pem;

Restart nginx server

Four. Automatic renewal of certificates

The certificate is valid for 90 days, and you need to write a scheduled task.

# Minute Hour Sun Moon Week Command

0 0, 12 * * * certificate update & gt/var/log/certbot.log &; Echo certbot was last updated `>>/var/log/certbot.log.

The certificate will be updated at 0: 00 and 12 every day, and the result will be saved in the log of/var /var/log/certbot.log