AWS with apache server and wordpress stores data at backend with aws RDS Free tier
Building a website with WordPress on AWS (Amazon Web Services) EC2 (Elastic Compute Cloud) and RDS (Relational Database Service) is a great choice for scalability, reliability, and performance. This guide will walk you through the steps to set up WordPress on an EC2 instance with RDS as the database.
Prerequisites:
Step 1: Launch an EC2 Instance
a) Select an AMI. Here I am selecting Amazon Linux 2 AMI.
Select AMI
b) Click next and Select the Instance Type. I’ll go for the default one.
Select Instance Type
c) Configure Instance Details
Instance Details
d) Add Storage
Add Storage
e) Add Tags
Here we can create multiple tags like name, env, etc. These tags are helpful in specifying the instance.
Attaching key
Here we can see, the instance is up !!
Instance launched
So step 1 is done. Now move to step 2.
Step 2: Configure the instance with Apache Webserver
Let’s connect with the instance. There are so many ways to connect with the instance
1. Using the browser
2. Using ssh
3. Using software like putty etc.
Here I am using the first way. You can choose any one of the above.
Connect to the instance
Note: All the images do not provide this option to connect.
Currently, we log in as ec2-user. This user doesn’t have the admin power so to switch with the root user, run the below command
sudo su -
Let’s Configure Apache Webserver !!
a) Install the Software
yum install httpd -y
b) Start the service and make it permanent
systemctl start httpd
systemctl enable httpd
Here we can see, that it is successfully configured
Home Page of Apache webserver
Download the PHP application named “WordPress”.
Requirements
· PHP version 7.4 or greater.
· MYSQL version 5.6 or greater OR MariaDB version 10.1 or greater.
· HTTPS support
1. Install PHP
To install php on Amazon Linux 2, we have to first install the amazon-linux-extras package. ( By default, it is installed )
领英推荐
yum install -y amazon-linux-extras
Enable PHP 7.4 package
amazon-linux-extras enable php7.4
Now install PHP packages from the repository.
yum clean metadata yum install php php-
{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
We can see the installed version of PHP using the below command
php -v
2. Download and extract the software
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
Download and extract the software
3. Upload the WordPress files in the root directory of the webserver
Note: Here I am using Apache webserver so the root directory of the webserver is /var/www/HTML
cp -r wordpress/* /var/www/html/
WordPress is installed !!
We can check it by going to the URL
https://<public_ip_of_server>/wp-admin/install.php
Successfully Installed
Here it will ask for the Database Information so we need to create a DataBase.
I am creating a MYSQL Database using AWS RDS, you can use MariaDB or other databases as per the requirement.
Step 4: Set up a MySQL server using AWS RDS service using Free Tier.
Go to AWS RDS Service →> Create Database
AWS RDS
Select MariaDB Engine
Different Engines
Templates ->> Free Tier ( You can select as per your requirement )
Settings ->> Set the Database name, Database User Name and password
DB Info
Note: Whatever password you set for database, it should be remembered. As we need it in the future.
Give database a name !
· Public Accessibility — yes
· Security Group — AllowAll ( You can customize it )
I Go for the default settings and create the Database for this task.
Database
Our database is created. We’ll use this endpoint to connect with WordPress.
Step 5: Provide the endpoint/connection string to the WordPress application to make it work.
DB Info
Or we can manually write this information in the wp-config-sample.php file and rename this file with wp-config.php
mv wp-config-sample.php wp-config.php
After Successfully Login you will see the Dashboard of WordPr
Keep Learning… Keep Sharing…
<<<<<<<<<<<<<<<<<<<<<< Thank you >>>>>>>>>>>>>>>>>>>>>
Data Engineer | Azure Data Engineer | Fabric Data Engineer | 2x Azure Certified | OCI & MongoDB Certified | Big Data & ETL Enthusiast
1 年It get slow