Skip to content

Instantly share code, notes, and snippets.

@teja156
Last active May 15, 2024 09:48
Show Gist options
  • Save teja156/8c35a05f43635da4cbd06b47c0d91e93 to your computer and use it in GitHub Desktop.
Save teja156/8c35a05f43635da4cbd06b47c0d91e93 to your computer and use it in GitHub Desktop.
Commands for deploying wordpress website on AWS EC2 shown in my YouTube video
YouTube video link: https://youtu.be/8Uofkq718n8
All the commands that are executed in the above youtube video are mentioned in this gist.
1. Install Apache server on Ubuntu
sudo apt install apache2
2. Install php runtime and php mysql connector
sudo apt install php libapache2-mod-php php-mysql
3. Install MySQL server
sudo apt install mysql-server
4. Login to MySQL server
sudo mysql -u root
5. Change authentication plugin to mysql_native_password (change the password to something strong)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'Testpassword@123';
6. Create a new database user for wordpress (change the password to something strong)
CREATE USER 'wp_user'@localhost IDENTIFIED BY 'Testpassword@123';
7. Create a database for wordpress
CREATE DATABASE wp;
8. Grant all privilges on the database 'wp' to the newly created user
GRANT ALL PRIVILEGES ON wp.* TO 'wp_user'@localhost;
9. Download wordpress
cd /tmp
wget https://wordpress.org/latest.tar.gz
10. Unzip
tar -xvf latest.tar.gz
11. Move wordpress folder to apache document root
sudo mv wordpress/ /var/www/html
12. Command to restart/reload apache server
sudo systemctl restart apache2
OR
sudo systemctl reload apache2
13. Install certbot
sudo apt-get update
sudo apt install certbot python3-certbot-apache
14. Request and install ssl on your site with certbot
sudo certbot --apache
@shahryar-cmyk
Copy link

If you have any issues regarding permalinks and pages showing error not found. Goto this path: /etc/apache2/sites-enabled and sudo nano 000-default.conf then add this code:

<Directory path/to/dir> Options Indexes FollowSymLinks AllowOverride All Require all granted </ Directory>

(the closing without space) Then restart apache2 sudo systemctl restart apache2

I tried this but the issue remains same.
image

@Novavamp
Copy link

Novavamp commented May 2, 2024

If you have any issues regarding permalinks and pages showing error not found. Goto this path: /etc/apache2/sites-enabled and sudo nano 000-default.conf then add this code:
<Directory path/to/dir> Options Indexes FollowSymLinks AllowOverride All Require all granted </ Directory>
(the closing without space) Then restart apache2 sudo systemctl restart apache2

I tried this but the issue remains same. image

Make sure you added the correct path to your website directory here: <Directory path/to/dir>

And remove the space at the closing tag (I added space so that GitHub doesn't change the output of the code).

@hayairfan
Copy link

hayairfan commented May 14, 2024

In the last part of the video, to request the SSL certificate for the domain, certbot failed to authenticate the domain. Can anyone help me?

Thanks

@teja156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment