How to Point Your Domain Name to Your AWS Lightsail Bitnami WordPress Website

This tutorial will teach you how to point a domain name purchased from a domain name registrar other than AWS Route 53 to your Bitnami WordPress site created through AWS Lightsail.

Prerequisites

  1. You have the public IP address for your website from the AWS Lightsail console – see How to Create a WordPress Blog using AWS Lightsail
  2. You have purchased a domain name for the site and you have access to the domain registrar’s admin area to change Domain Name System (DNS) settings

Pointing your domain to your website

Step 1 – Login to AWS Console and go to Route 53

Step 2 – Click on Hosted Zones and create a hosted zone with the domain name you have purchased – enter it without the www

Step 3 – Select the type as a public hosted zone

Step 4 – You will see a type NS with four entries like ns-95-awsdns-11.com in the Value column, make a note of them

Step 5 – Create a subdomain for the www prefix by entering the following in the Create Record Set area on the right-hand side:

  • Type: A – IPv4 address
  • Alias: Yes
  • Alias Target:  select your domain name
  • Routing Policy: Simple
  • Evaluate target health: No

Step 6 – Login into the domain registrar’s admin panel i.e. where you bought your domain name

Step 7 – Select the domain you want to manage

Step 8 – Go to Manage DNS Settings or similar

Step 9 – Change the Name Servers to the AWS name servers noted in Step 4.  There may be two default settings but you need to overwrite them and add two more so it shows the four namespace servers from AWS

Step 10 – Save the settings and wait for a few minutes, your website should now appear when you put its URL in the browser.

How to Install an SSL Certificate on an AWS EC2 Bitnami WordPress Site

In this article, I show you how to install a SSL certificate on your AWS Bitnami WordPress server.

Prerequisites

Okay, before we start I’m assuming you have already:

  1. Created the Bitnami WordPress site – see How to Create a WordPress Blog Using AWS Lightsail
  2. Purchased a SSL certificate from a Certificate Authority (CA) and downloaded it to your computer – see How to Create a Certificate Signing Request (CSR) – Apache
  3. Created a private key file (see link in 2 above)
  4. Have a way of connecting to your server via SSH – see How to Connect to an Amazon Web Services (AWS) EC2 Instance Using SSH



Install the SSL Certificate

When you’ve done these preliminary steps, you need to:

Step 1 – Open the folder you downloaded to your computer from the SSL certificate provider. This should contain one or two files which look like:

How to Install a SSL Certificate on a AWS Bitnami WordPress Site
Example certificates

Step 2 – Copy the certificate files to the correct locations on your AWS EC2 or Lightsail instance using SSH – See How to Copy Files to an AWS EC2 Instance Using SFTP

You created the key file when you created the Certificate Signing Request for the SSL certificate.

The correct directories for each file are:

File Directory
Certificate file /opt/bitnami/apache2/conf/your.crt
Certificate key file /opt/bitnami/apache2/conf/your.key
CA Certificate bundle file (if present) /opt/bitnami/apache2/conf/your-bundle.crt
* replace your with your files

Step 3 – Check the Apache version running on the server using the terminal command as you will need to know this for Step 5.

$ httpd -v

The server version will be displayed as Apache/2.4.xx in the terminal.

How to Install a SSL Certificate on a AWS EC2 Bitnami WordPress Site
Check the Apache server version using httpd -v

Step 4 – Open the bitnami.conf file using the following command

$ nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

Step 5 – Scroll down to the <VirtualHost _default_:443> section and replace the default server.crt files with the correct certificate file names for the files uploaded in Step 2 above.

How to Install a SSL Certificate on a AWS EC2 Bitnami WordPress Site
Amend the configuration file with the correct certificate and key file names

Step 6 – Add a line for your CA Certificate bundle file

If your Apache version is lower than v2.4.8, add this line under the SSLCertificateKeyFile

SSLCertificateChainFile "/opt/bitnami/apache2/conf/your-bundle.crt"

If your Apache version is v2.4.8 or above, add this line under the SSLCertificateKeyFile

SSLCACertificateFile "/opt/bitnami/apache2/conf/your-bundle.crt"

Important – make sure the file names have been entered correctly in the configuration file and the certificates are located in the correct directories before proceeding further.

Step 7 – Save the file by pressing ctrl-X on your keyboard and Y to save changes

Step 8 – Make the files readable by the root user only by entering the following commands in the terminal:

$ sudo chown root:root /opt/bitnami/apache2/conf/server* $ sudo chmod 600 /opt/bitnami/apache2/conf/server*

Step 9 – Check the firewall to see if Port 443 is open (default setting in AWS Lightsail Bitnami installation) – see xxxINSERT LINK HERExxx

Step 10 – Restart the Apache server using

$ sudo /opt/bitnami/ctlscript.sh restart apache

If you get any errors check Step 5 again, otherwise your certificate should now be installed and the padlock sign appears when entering the URL in a browser.