Install Let’s Encrypt Free SSL certificate for a domain
Step 1 – Install SSL
$wget https://dl.eff.org/certbot-auto
$chmod a+x certbot-auto
Step 2 – Create domain SSL certificate
$sudo ./certbot-auto –debug -v –server https://acme-v01.api.letsencrypt.org/directory certonly -d yourdomainname.com
Select the options – apache – 1 and enter contact email
Step 3 – Configure virtual host
<VirtualHost *:443>
ServerName yourdomainname.com
ServerAlias www.yourdomainname.com
DocumentRoot /var/www/vhosts/yourdomainname.com/html
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/yourdomainname.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomainname.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/yourdomainname.com/fullchain.pem
ServerAdmin [email protected]
ErrorLog /var/www/vhosts/logs/error_log
<Directory /var/www/vhosts/yourdomainname.com/html>
AllowOverride All
</Directory>
</VirtualHost>
Step 4 – Certificate automatically renewal process by cron job
$sudo -s
$nano crontab.txt
30 2 * * Sun /home/ec2-user/certbot-auto renew
$crontab crontab.txt
$service httpd restart or sudo /etc/init.d/apache2 restart
All done and try the domain with HTTPS protocol.