Harnessing the Power of AWS: A DevOps Guide to Hosting Your WordPress Website – Part 2

  • Published
  • Posted in AWS
  • Updated
  • 4 mins read
  • Tagged as

In our last blog we launch the EC2 instance, downloaded .tar file for WordPress.
In this blog, we will launch the WordPress sample website, make it available on the user-friendly domain name and make it follow HTTPS protocol.

To install WordPress on EC2 click on Let’s Go button as per the image shown below.

A screenshot of a computer

Description automatically generated

Click on Let’s go to install WordPress and move forward.

Enter the details as follows:

  1. Database Name: wp
  2. Username: wp_user
  3. Password: (Set any password) (Testpassword@123)
  4. Database host: localhost
  5. Table Prefix: wp_

And click on Submit

It will give us an error as follows.

A screenshot of a computer

Description automatically generated

To resolve this error, we need to create a wp-config.php file in EC2 instance and paste the following code. (keep the same page as it is on the browser).

To do so, copy the code and go to EC2 console to directory : /var/www/html/wordpress and create a new file with command
sudo vim wp-config.php and paste the code in it.
Once done with it, go to the page and click on “Run Installation”. It will take you to next page.

We need to enter site details like
Site title: WordPress Sample Website

Username: Shashank 

Password: Any password

Email address: enter your email address

And click on Install WordPress.

It will gives us message as follows:

A screenshot of a computer

Description automatically generated

If you want to customize the website, login with the credentials created in our last step.

Now if you can go to <Instance IPv4>/wordpress, that will show us the website.

Now I do not want to go to the website by entering like <Instance IPv4>/wordpress. But by just entering the Instance IPv4, the website should be up and running.

To do so, go back to the MobaXterm terminal, and go to cd /etc/apache2/sites-available. You will see 2 files : 000-default.conf and default-ssl.conf . We need to edit 000-default.conf

Open the file with command sudo vim 000-default.conf and edit it as follows.

A screenshot of a computer screen

Description automatically generated

And save the file.

Now We want our website to be available at our domain name like “tremyda.com”. Add an A record in the Domain Registrar of the tremyda.com (in my case) pointing it to Instance IPv4 in DNS Records section.

Now the website will run at the domain name. In my case it will be tremyda.com

Now we will login into the wp-admin which is available at website/wp-admin

(in my case : tremyda.com/wp-admin)

We will be redirected to instance public IPv4, which we need to avoid. To do so we will login into the wordpress website admin page using the credentials we set before.

Go to Settings 🡪 General 🡪 and change the WordPress address (url) to http://tremyda.com. Copy the same thing for Site Address (url) and save the changes.

Now the website will point at DNS in all cases.

The only thing remaining is to make the site secure with SSL certificate.

This can be done using certbot tool.

It can be run using the cmd: 

sudo apt-get update

sudo apt install certbot python3-certbot-apache

You will get few prompts, enter accordingly.

Like enter your email address, Agree to terms and conditions : Y, Would you  willingly share your email address when certificate is successfully issued : N

Which names would you like to activate HTTPS for ?
Since we have added 2 DNS, we will just enter without specifying anything, so it will consider all of them and make them secure.

It will give us the message that the domains are successfully made secure with the tool certbot.

Our website is launched with HTTPS protocol.

In conclusion, launching a website using WordPress and securing it with an SSL certificate is a fundamental step in creating a safe, professional, and trustworthy online presence. WordPress provides a versatile platform for creating and managing content, while an SSL certificate ensures the privacy and security of the data transmitted between the user’s browser and the webserver.

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.