Secure your website using Let’s Encrypt with Certbot SSL

After watching the below video about HTTPS, I decided to finally make the move over to SSL. Fortunately, there’s a free way of doing so by using Let’s Encrypt. I’m going to provide the exact steps I took, which really wasn’t hard at all. Let’s get to it.

OS: CentOS release 6.8 (Final)
Web Application: httpd – Server version: Apache/2.2.15 (Unix)

Run the following commands as root.

cd
yum install epel-release
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto

Create conf

I created a separate conf file within /etc/httpd/conf.d/ (removed the old one within /etc/httpd/conf/httpd.conf).

Notice I added a redirect for all http requests to be forwarded to https.

vi /etc/httpd/conf.d/vhost-itsmetommy.com.conf
<VirtualHost *:80>
 ServerName itsmetommy.com
 DocumentRoot /var/www/itsmetommy.com/public_html
 DirectoryIndex index.html index.php
</VirtualHost>

Restart httpd

/etc/init.d/httpd restart

Run certbot-auto

./certbot-auto

Setup auto renewal using cron

Runs renew command every 6 hours.

crontab -e
*/6 * * * * /root/certbot-auto renew --quiet --no-self-upgrade

Congratulations! You’ve made your website secure.