Skip to main content

Install Certbot

sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo nano /etc/nginx/sites-available/default

Edit file

/etc/nginx/sites-available/default
server_name example.com www.example.com;

Check and reload Nginx

sudo nginx -t
sudo systemctl reload nginx

Get certificate

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

Check certbot

# Check timer
systemctl status certbot.timer
# Check work
sudo certbot renew --dry-run

For CentOS add to cron:

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