Let's Encrypt provides free SSL certificates. Use Certbot to automate the process.
Install Certbot
# Ubuntu/Debian with Nginx
apt install certbot python3-certbot-nginx -y
# Ubuntu/Debian with Apache
apt install certbot python3-certbot-apache -yObtain a Certificate
# Nginx
certbot --nginx -d example.com -d www.example.com
# Apache
certbot --apache -d example.com -d www.example.comAuto-Renewal
Certbot installs a systemd timer for automatic renewal. Verify:
certbot renew --dry-runManual Renewal
certbot renewCertificate Location
/etc/letsencrypt/live/example.com/fullchain.pem
/etc/letsencrypt/live/example.com/privkey.pem