using letsencrypt for ssl certificates
letsencrypt is an easy way to make SSL certificates for your website and it's free. The only issue is you have to renew the certificates (certs) every few months. You can automate that using cron.
letsencrypt --renew-by-default --domains
or
certbot-auto renew
These items are normally in /usr/bin or /usr/local/bin so put the full path before them in the crontab to make sure you don't get a file not found error.
Suppose you want the check monthly on the first of each month:
sudo crontab -e
* * 1 * * /usr/local/bin/certbot-auto renew
The most important thing with letsencrypt is to make sure your apache config file is correct. If you give a domain name without www, make sure you put it in the config file as www. Here's an example.
<VirtualHost *:80>
DocumentRoot /var/www/domain.com
Options All Indexes ExecCGI SymLinksIfOwnerMatch
ErrorDocument 404 /error.html
ServerName www.domain.com
ServerAlias www.domain.co.za
ServerAlias domain.com
ServerAlias domain.co.za
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/domain.com
Options All Indexes ExecCGI FollowSymLinks
ErrorDocument 404 /error.html
ServerName www.domain.com
ServerAlias www.domain.co.za
ServerAlias domain.com
ServerAlias domain.co.za
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/domain.co.za-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.co.za-0001/privkey.pem
</VirtualHost>