Day 45 - Deploy Wordpress website on AWS
Launch an EC2 instance
Create an AWS RDS
Please check the previous blog to create RDS
Setup the server and deploy WordPress
Connect to instance via SSH.
Install MySQL on the server and connect with the database.
sudo apt install mysql-client mysql -h <Endpoint> -P <portno.> -u <Username> -p
Create a database user for your WordPress application and give the user permission to access the WordPress database by using below commands.
CREATE DATABASE wordpress; CREATE USER 'wordpress' IDENTIFIED BY 'wordpress-pass'; GRANT ALL PRIVILEGES ON wordpress.* TO wordpress; FLUSH PRIVILEGES; Exit
Install apache2 on the server
sudo apt-get update && sudo apt install -y apache2 sudo systemctl restart apache2
Check the public IP URL to view the Apache2 web page.
Install WordPress on the server.
wget https://wordpress.org/latest.tar.gz tar -xzf latest.tar.gz
Copy the sample config file and create a new wp-config.php file
Edit the database configuration in the file and a set of unique keys needs to be provided to the config file also.
define('AUTH_KEY', 'H&|6E`hwKfr{:%)c/VnnD`_juO2G-x5%ja|%aG^o6reM^5-82YAk$?-ScRV(l~*U'); define('SECURE_AUTH_KEY', '+)PXuaoX4 ,!@P)w+b$th=dWerlvoo=|<hBM2-QK@+G<hE<!04/!H;8>Cq5;GPDl'); define('LOGGED_IN_KEY', 'PCXFt:mB+i+jnQGP@m~fkgLaLrR%Q@J*>$M} tUj1U|k2;my])l1!M{E/sQ)(CCY'); define('NONCE_KEY', 'h?t[<nk|:T?AWMJAQGxa`{%pEZ|rc}08zO9pOZl~V{3>XB~<q?ac$+_!%|+Cc<?)'); define('AUTH_SALT', 't, E$7#wcey47lR=`_Yyi]u-E?.j%.MC_Hx0{iV+T[iBj[w)q!JD4Y?+:$_!a+|&'); define('SECURE_AUTH_SALT', 'uMDw+%k5dEY#|`&w!SoH@::~<@jCyG>yP=Rcv^`NN1,+)K:Buv+J-~Y}olc}`-tT'); define('LOGGED_IN_SALT', 't+W]CZ684~.aOve+-,g2x&TI+q,QJ&5E}<q9x;sLx$+[t<+t9VC-ZMD7~8`%+@--'); define('NONCE_SALT', 'DBr&#AO/#|tGwm|wv0L@X^|>7i #DiFc^gnq;uO +8v5az3lh8*/ u6yQ!1v^-jH');
Install the dependency of the application on the server.
sudo apt install php libapache2-mod-php php-mysql -y
Copy the file contents from the WordPress folder to /var/www/html folder to configure the application with the Apache web server.
sudo cp -r wordpress/* /var/www/html/
Restart the Apache web server and Navigate to <public IP>/wp-admin/ to view the WordPress website.
systemctl restart apache2
We can create a user on the WordPress site.
Thank you for reading!!
~Shreya Gupta
Great initiative by the #trainwithshubham community. Thank you Shubham Londhe
#devops #90daysofdevops #aws #iam #s3 #rds #awsprojects
Subscribe to my newsletter
Read articles from Shreya Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Shreya Gupta
Shreya Gupta
I am a software engineer having working experience of 4+ years. I have been a part of web development and have hands-on experience in Laravel, Html, Codeigniter, CSS, PHP, OOPS, Bootstrap, React, Javascript, jQuery and Linux. Currently learning DevOps, AWS & more skills.