Securing your WordPress site with an SSL certificate is essential for protecting user data and improving search engine rankings. Amazon Lightsail makes it easy to add SSL certificates to your WordPress site. This guide will walk you through the process of setting up SSL certificates on WordPress hosted on Amazon Lightsail.
Why Use SSL Certificates?
-
Data Protection: SSL encrypts data transferred between your site and its visitors.
-
SEO Benefits: Search engines prioritize secure sites, potentially improving your search rankings.
-
User Trust: A secure site fosters trust and confidence among your visitors.
Step-by-Step Guide to Setting Up SSL
Step 1: Connect to Your Lightsail Instance
First, connect to your Lightsail instance using SSH.
-
SSH Connection: Use an SSH client or Lightsail’s built-in SSH terminal.
Copy to Clipboard
Step 2: Install Certbot
Certbot is a free tool that automates the process of obtaining and renewing SSL certificates from Let’s Encrypt.
-
Update Package List: Ensure your package list is up-to-date.
Copy to Clipboard
Install Certbot: Install Certbot and its dependencies.
Copy to Clipboard
Step 3: Obtain an SSL Certificate
Use Certbot to request an SSL certificate for your domain.
-
Run Certbot: Execute Certbot with the necessary parameters.
Copy to Clipboard
-
Follow the prompts to complete the process. Certbot will place the certificate files in
/etc/letsencrypt/live/yourdomain.com
.
Step 4: Configure Apache for SSL
Update your Apache configuration to use the new SSL certificate.
-
Edit Configuration File: Open the Bitnami SSL configuration file.
Copy to Clipboard
Update SSL Settings: Modify the VirtualHost
directive to include the paths to your SSL certificate files.
Copy to Clipboard
Step 5: Enable HTTP to HTTPS Redirection
Ensure all traffic is redirected to HTTPS.
-
Update bitnami.conf: Add a redirection directive.
Copy to Clipboard
Step 6: Restart Apache
Restart the Apache server to apply the changes.
-
Restart Command: Use the following command to restart Apache.
Copy to Clipboard
Step 7: Verify SSL Installation
Check your site to ensure the SSL certificate is working correctly.
-
Visit Your Site: Open your browser and navigate to
https://yourdomain.com
. -
SSL Checker: Use an online tool like SSL Labs’ SSL Test to verify the certificate installation.
Step 8: Set Up Auto-Renewal
Certbot can automatically renew your SSL certificates. Set up a cron job to handle this.
-
Open Crontab: Edit the crontab for the root user.
Copy to Clipboard
Add Cron Job: Add the following line to renew the certificate every 12 hours.
Copy to Clipboard
Copy to Clipboard