How To Enable HTTPS In AWS Lightsail WordPress Instance?
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
Today we are going to discuss how to enable https communication in your WordPress website hosted with AWS Lightsail. You can use free TSL certificate providers like Lets encrypt to enable HTTPS in your WordPress website hosted in AWS Lightsail.
How To Enable HTTPS In AWS Lightsail WordPress Instance?
Prerequisites:
A WordPress Website Hosted In AWS Lightsail
Step 1: Login to AWS management console.
Step 2: Create a DNS CNAME record for www.<domain_name>.<TLD> against your <domain_name>.<TLD>.
For example, domain name used in this demo is techaffaire.com and we want user to navigate to our website using either https://techaffaire.com or https://www.techaffaire.com and want the SSL valid for both the domain name (techaffaire.com) and sub-domain name (www.techaffaire.com). Also, if you want to use any other sub-domain like https://contact.techaffaire.com , you need to create a CNAME for each of the sub-domain. We are using AWS Route53 as the domain registrar, but the process is same for any other domain registrar like GoDaddy.
Navigate to Route53 service => Hosted Zone => Create record and create a CNAME record for each of the subdomains.
Step 3: Navigate to Lightsail console.
Step 4: Connect to your Lightsail WordPress instance either through browser by clicking on the “command” icon or using SSH connection.
Step 5: Enable TSL for your Lightsail WordPress instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
## Try to enable TSL for your Lightsail WordPress instance sudo /opt/bitnami/bncert-tool ## If you see command not found, follow below steps to install bncert ## 1. download the bncert run file to your instance. wget -O bncert-linux-x64.run https://downloads.bitnami.com/files/bncert/latest/bncert-linux-x64.run ## 2. create a directory for the bncert run file on your instance. sudo mkdir /opt/bitnami/bncert ## 3. move the downloaded bncert run file to the new directory you created. sudo mv bncert-linux-x64.run /opt/bitnami/bncert/ ## 4. make the bncert run a file that can be executed as a program. sudo chmod +x /opt/bitnami/bncert/bncert-linux-x64.run ## 5. create a symbolic link that runs the bncert tool sudo ln -s /opt/bitnami/bncert/bncert-linux-x64.run /opt/bitnami/bncert-tool ## Enable SSL for your Lightsail WordPress instance sudo /opt/bitnami/bncert-tool ## Welcome to the Bitnami HTTPS Configuration tool. ## ---------------------------------------------------------------------------- ## Domains ## Please provide a valid space-separated list of domains for which you wish to ## configure your web server. ## Domain list []: techaffaire.com www.techaffaire.com ## ---------------------------------------------------------------------------- ## Enable/disable redirections ## Please select the redirections you wish to enable or disable on your Bitnami ## installation. ## Enable HTTP to HTTPS redirection [Y/n]: Y ## Enable non-www to www redirection [Y/n]: Y ## Enable www to non-www redirection [y/N]: Y ## ---------------------------------------------------------------------------- ## Changes to perform ## The following changes will be performed to your Bitnami installation: ## 1. Stop web server ## 2. Configure web server to use a free Let's Encrypt certificate for the domains: ## techaffaire.com www.techaffaire.com ## 3. Configure a cron job to automatically renew the certificate each month ## 4. Configure web server name to: techaffaire.com ## 5. Enable HTTP to HTTPS redirection (example: redirect http://techaffaire.com to ## https://techaffaire.com) ## 6. Enable www to non-www redirection (example: redirect www.techaffaire.com to ## techaffaire.com) ## 7. Start web server once all changes have been performed ## Do you agree to these changes? [Y/n]: Y ## ---------------------------------------------------------------------------- ## Create a free HTTPS certificate with Let's Encrypt ## Please provide a valid e-mail address for which to associate your Let's Encrypt certificate. ## Domain list: techaffaire.com www.techaffaire.com ## Server name: techaffaire.com ## E-mail address []: ## The Let's Encrypt Subscriber Agreement can be found at: ## https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf ## Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: Y ## ---------------------------------------------------------------------------- ## Performing changes to your installation ## The Bitnami HTTPS Configuration Tool will perform any necessary actions to your ## Bitnami installation. This may take some time, please be patient. ## ---------------------------------------------------------------------------- ## Success ## The Bitnami HTTPS Configuration Tool succeeded in modifying your installation. ## The configuration report is shown below. ## Backup files: ## * /opt/bitnami/apache/conf/httpd.conf.back.202112170547 ## * /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202112170547 ## * /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202112170547 ## * /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202112170547 ## * /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202112170547 ## Find more details in the log file: ## /tmp/bncert-202112170547.log ## If you find any issues, please check Bitnami Support forums at: ## https://community.bitnami.com ## Press [Enter] to continue: |
We have successfully enabled SSL to our WordPress website hosted in AWS Lightsail. Now if you browse to your domain, you will be able to connect using HTTPS.
To get more details on Lightsail, please refer below official documentation.
https://lightsail.aws.amazon.com/ls/docs/en_us/all