Wednesday, March 31, 2021

[How To] Install Free SSL Certificate for WordPress

In this tutorial, I have installed a free SSL certificate from Let's Encrypt using the Certbot tool on Google Cloud Platform VM running Debian OS that hosts a WordPress site using Apache server. You can follow similar steps for other Cloud providers / OS distributions / CMS vendors / Web servers.

Part-1: Configure Virtual Host for your domain on Apache

cd /var/www/html

wp option update home ''

wp option update siteurl ''

sudo nano /etc/apache2/sites-available/

sudo apache2ctl configtest

sudo a2ensite

sudo systemctl reload apache2

Part-2: Remove Certbot if previously installed (Optional)

sudo apt remove certbot

sudo sed -i '/certbot-auto/d' /etc/crontab

sudo rm -rf /opt/

sudo snap remove certbot

sudo apt autoremove

Part-3: Install Certbot

sudo apt update

sudo apt upgrade

sudo apt install snapd

sudo snap install core

sudo snap refresh core

sudo snap install --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Part-4: Install SSL Certificates

sudo certbot --apache -d -d

sudo certbot renew --dry-run

crontab -e

sudo ls -l /etc/letsencrypt/live/

Content of

<VirtualHost *:80>



ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

<Directory /var/www/html>

Options -Indexes +FollowSymLinks

AllowOverride All


ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined


No comments:

Post a Comment