Steps:
AWS Account
Ubuntu 20.04 instance
Prerequisite to setup WordPress
Final verification of WordPress website
AWS Account: You should have AWS account to perform this task
- We are using Ubuntu 20.04 OS to set up WordPress.
- If you are setting up WordPress just for practice then “t2.micro” instance is fine for this work. Otherwise if you have plan to use this instance for real website then you should use instance type according to the expected load/traffic on your website.
Configure Instances and Add storage options will be remain same (default) but if you are using this instance for your actual website then you should follow AWS best practices.
Configure Security Group we need SSH and HTTP type should be open to the world (*for best practice ssh port 22 should allow just your ip address and after performing your work you should remove it from ingress rule).
Now review and launch
SSH your instance using Putty or command line
Prerequisite to setup WordPress
Install php with all packages
Install apache2
Install mysql-server
Commands: Follow below commands
apt update -y
sudo apt install php libapache2-mod-php php-mysql php-redis
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
apt install apache2
apt install mysql-server
systemctl enable apache2 mysql
wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mkdir /var/www/wordpress
sudo cp -R wordpress /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress
sudo chmod -R 775 /var/www/html/wordpress
sudo mysql -u root
Now we create database, user with password
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'wppassword';
GRANT ALL PRIVILEGES ON * . * TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
exit
Now we will create .conf file inside site-available
sudo nano /etc/apache2/sites-available/wordpress.conf
Now update the below details in it
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
Now run below commands
sudo a2enmod rewrite
Now to test the configurations
sudo apache2ctl configtest
Result:
Syntax OK
Now restart apache2
sudo systemctl restart apache2
Now access the “wp-config.php” file and add the database credentials
Now we will access WordPress website through our EC2 instance public IP address
Here we have our WordPress website
Now you just need to configure with your website details and enjoy :)
Top comments (0)