AWS Documentation

  1. Home
  2. Docs
  3. AWS Documentation
  4. AWS WordPress with php8.0 on Amazon Linux 2 Kernel 5.10

AWS WordPress with php8.0 on Amazon Linux 2 Kernel 5.10

This AMI supports following versions.

  • Amazon Linux 2 Kernel 5.10
  • PHP 8.0
  • Apache 2.4
  • MariaDB 10.5
  • phpMyAdmin 5.2
  • WordPress 6.3

Web Server

We prepared SSL/TLS so you can access to top page using http:// or https://.

WordPress Installation

Once the instance is running, please access your WordPress hosting domain or enter the public DNS provided by AWS (IPv4 Public IP) into your browser.

https://{wordpress host or IP}/

You will see the WordPress application. Chose your language settings.

Since the wp-config.php file already exists, you may see the following message. If this is the case, simply click “installing now” to continue.

Specify your account details including username and password, and click “Install WordPress”.

You should see this success message indicating that your WordPress account has been created.

Options

phpMyAdmin

You can access to phpMyAdmin after creating ssh tunnel.

How to Set up SSH Tunneling (Port Forwarding)

ex.) create ssh tunnel

$ ssh ec2-user@{ipaddress} -i {ssh-key-file.pem} -N -L 8080:localhost:80

http://localhost:8080/phpMyAdmin/

For phpMyAdmin please refer to phpMyAdmin User Guide

Find database password

You can find the database server password by accessing the System Log in the EC2 management console:

  1. Go to the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  2. Chose your Instance and Click Actions → Monitor and troubleshooot → Get System log
  1. Get System log as shown below.

You can also SSH into your instance and find the login credential using the following command.

$ cat /home/ec2-user/credentials 
////////////////////credentials info////////////////////
--- WordPress
----- Setting  : Success
--- phpMyAdmin
----- Setting  : Success
--- MariaDB
----- User     : root
----- Password : ****************
----- User     : wordpress
----- Password : ****************
////////////////////////////////////////////////////////

Changing URL

You can change the WordPress URL by using wp-cli. You can change it by executing the following command after logging into the instance over SSH.


$ wp search-replace 'old_site_url' 'new_site_url' --path=/var/www/html/wordpress --skip-columns=guid

For example, when your instance IP was changed from xxx.xxx.xxx.xxx to yyy.yyy.yyy.yyy you can check URL as shown below: To update the URL, execute the following command:

$ wp search-replace xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy --path=/var/www/html/wordpress --skip-columns=guid
+------------------+-----------------------+--------------+------+
| Table            | Column                | Replacements | Type |
+------------------+-----------------------+--------------+------+
| wp_commentmeta   | meta_key              | 0            | SQL  |
| wp_commentmeta   | meta_value            | 0            | SQL  |
<...>
| wp_links         | link_rss              | 0            | SQL  |
| wp_options       | option_name           | 0            | SQL  |
| wp_options       | option_value          | 2            | PHP  |
| wp_options       | autoload              | 0            | SQL  |
| wp_postmeta      | meta_key              | 0            | SQL  |
| wp_postmeta      | meta_value            | 0            | PHP  |
| wp_posts         | post_content          | 4            | SQL  |
| wp_posts         | post_title            | 0            | SQL  |
<...>
| wp_users         | user_nicename         | 0            | SQL  |
| wp_users         | user_email            | 0            | SQL  |
| wp_users         | user_url              | 1            | SQL  |
| wp_users         | user_activation_key   | 0            | SQL  |
| wp_users         | display_name          | 0            | SQL  |
+------------------+-----------------------+--------------+------+
Success: Made 7 replacements.

Reference

How can we help?