Skip to main content

Let's Encrypt

Install certbot

apt update
apt install certbot python3-certbot-nginx

Edit nginx config file

nano /etc/nginx/sites-available/default

Add domain names

server_name example.com <www.example.com>;

Check config files

nginx -t

Reload nginx

systemctl reload nginx

Create new cert

certbot --nginx -d example.com -d <www.example.com> --non-interactive --agree-tos -m <[email protected]>

Check timer

systemctl status certbot.timer

Check work

certbot renew --dry-run

For CentOS add to cron

crontab -e
30 4 ** * /usr/bin/certbot renew --quiet