Secure your website using Let’s Encrypt with Certbot SSL


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 * * * * scl enable python27 '/root/certbot-auto renew'

Congratulations! You’ve made your website secure.

,