WordPress User Guide
Overview
This guide covers the deployment and configuration of WordPress on Linux using cloudimg AMIs from the AWS Marketplace. WordPress is the world's most popular content management system (CMS), powering websites, blogs, and online stores.
What's included in this AMI:
- WordPress with preconfigured database connectivity
- MySQL database server with dedicated storage volume
- Apache HTTP Server (httpd) for serving web content
- PHP runtime environment
- Randomly generated database credentials
- OS package update script for keeping the system current
- AWS CLI v2 for AWS service integration
- Systems Manager Agent (SSM) for remote management
- CloudWatch Agent for monitoring
- Latest security patches applied at build time
- 24/7 cloudimg support with guaranteed 24 hour response SLA
Prerequisites
Before launching this AMI, ensure you have:
- An active AWS account
- An active subscription to the WordPress listing on AWS Marketplace
- An EC2 key pair for SSH access
- Familiarity with EC2 instance management and SSH
Recommended Instance Type: t3.small (2 vCPU, 2 GB RAM) or larger. The minimum requirements are 1 vCPU, 1 GB RAM, and 20 GB disk space.
Step 1: Launch the AMI
- Navigate to the AWS Marketplace and search for "WordPress cloudimg"
- Click Continue to Subscribe, accept the terms, then Continue to Configuration
- Select your preferred Region and Software Version
- Click Continue to Launch
- Choose Launch through EC2 for full control over instance configuration
- Select your instance type (
t3.smallrecommended) - Configure storage: 20 GB gp3 minimum
- Configure your Security Group with the following inbound rules:
| Port | Protocol | Source | Purpose |
|---|---|---|---|
| 22 | TCP | Your IP | SSH access |
| 80 | TCP | 0.0.0.0/0 | WordPress site (HTTP) |
| 443 | TCP | 0.0.0.0/0 | WordPress site (HTTPS, if configured) |
| 3306 | TCP | Your IP | MySQL database (remote access, optional) |
Important: Port 3306 should only be opened if you need remote database access. For most deployments, MySQL is accessed locally and this port should remain closed.
- Select your EC2 key pair and launch the instance
Step 2: Connect via SSH
Once your instance is running and has passed both status checks (2/2), connect using SSH:
ssh -i your-key.pem ec2-user@<public-ip-address>
Replace your-key.pem with the path to your EC2 key pair and <public-ip-address> with your instance's public IP.
Important: Wait for the EC2 instance to reach 2/2 successful status checks before attempting to connect. If you connect too early, you may see errors such as:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
To switch to the root user:
sudo su -
Step 3: Review Database Credentials
The WordPress database connection is preconfigured in /var/www/html/wp-config.php. Two credential files are available for reference:
MySQL root password:
cat /stage/scripts/mysql_root_password.log
WordPress database password:
cat /stage/scripts/mysql_wordpress_password.log
Note: The MySQL root user has been disabled for remote login as a security best practice. Only local connections from the server command line are permitted.
Step 4: Complete the WordPress Setup Wizard
The Apache HTTP server starts automatically on boot, making WordPress accessible immediately. Navigate to:
http://<public-ip-address>/wp-admin
You will see the WordPress setup wizard:
- Select your language and click Continue
- Enter site information:
- Site Title: Your website name
- Username: Choose an admin username
- Password: Set a strong password (make a note of this)
- Your Email: Enter a valid email address
- Search Engine Visibility: Optionally check "Discourage search engines from indexing this site" during development
- Click Install WordPress
- Click Log In and enter the credentials you just created
You are now logged in to the WordPress dashboard and the site is ready for use.
Server Components
| Component | Config Path |
|---|---|
| MySQL | /etc/my.cnf |
| Apache | /etc/httpd OR /etc/apache2 |
| PHP | /etc/php.ini |
| WordPress | /var/www/html/ |
Note: Component versions may be updated on first boot by the automatic OS package update script.
Filesystem Layout
| Mount Point | Size | Description |
|---|---|---|
| / | 38 GB | Root filesystem |
| /boot | 2 GB | Operating system kernel files |
| /var/lib/mysql | 9.8 GB | MySQL database data directory |
| /var/www/html | 9.8 GB | WordPress site root |
Key directories:
| Directory | Purpose |
|---|---|
| /var/www/html | WordPress installation root |
| /var/www/html/wp-content | Themes, plugins, and uploads |
| /var/www/html/wp-content/uploads | Media uploads |
| /var/www/html/wp-config.php | WordPress database and configuration |
| /var/lib/mysql | MySQL database files |
| /etc/httpd/conf | Apache configuration (RedHat based) |
| /etc/apache2 | Apache configuration (Debian based) |
Managing Services
MySQL:
service mysqld status
service mysqld stop
service mysqld start
Apache HTTP Server (RedHat based):
systemctl status httpd
systemctl stop httpd
systemctl start httpd
Apache HTTP Server (Debian based):
systemctl status apache2
systemctl stop apache2
systemctl start apache2
Access the MySQL command line:
mysql -u root -p
# Enter the password from /stage/scripts/mysql_root_password.log
Check PHP version:
php -v
Scripts and Log Files
| Script/Log | Path | Description |
|---|---|---|
| initial_boot_update.sh | /stage/scripts | Updates the OS with the latest packages on first boot |
| initial_boot_update.log | /stage/scripts | Output log for the boot update script |
| mysql_root_password.log | /stage/scripts | MySQL root database password |
| mysql_wordpress_password.log | /stage/scripts | WordPress database user password |
On Startup
An OS package update script runs on first boot to ensure the image is fully up to date. You can disable this by removing the script and its crontab entry:
rm -f /stage/scripts/initial_boot_update.sh
crontab -e
# Delete the following line, save and exit:
@reboot /stage/scripts/initial_boot_update.sh
Troubleshooting
Cannot access WordPress on port 80
- Verify Apache is running:
systemctl status httpdorsystemctl status apache2 - Check your security group allows inbound traffic on port 80
- Ensure the instance has passed 2/2 status checks
- Check Apache error logs:
tail -f /var/log/httpd/error_log
Database connection error on WordPress
- Verify MySQL is running:
service mysqld status - Check the credentials in
/var/www/html/wp-config.phpmatch those in the log files - Test the database connection:
mysql -u root -p - Check MySQL error logs:
tail -f /var/log/mysqld.log
WordPress shows "Error establishing a database connection"
- Restart MySQL:
service mysqld restart - Verify the WordPress database exists:
mysql -u root -p -e "SHOW DATABASES;" - Check disk space:
df -h /var/lib/mysql
Cannot upload media files
- Check PHP upload limits in
/etc/php.ini: upload_max_filesize(default may be 2M)post_max_size- Check directory permissions:
ls -la /var/www/html/wp-content/uploads/ - Ensure Apache has write access:
chown -R apache:apache /var/www/html/wp-content/uploads/
Security Recommendations
- Change database passwords: Update the MySQL root and WordPress database passwords after deployment
- Enable HTTPS: Install an SSL certificate using Let's Encrypt (
certbot) for encrypted connections - Keep WordPress updated: Regularly update WordPress core, themes, and plugins from the dashboard
- Use strong admin passwords: Choose a complex password for the WordPress admin account
- Limit login attempts: Install a plugin to prevent brute force attacks on wp-login.php
- Disable file editing: Add
define('DISALLOW_FILE_EDIT', true);to wp-config.php - Restrict database access: Keep port 3306 closed in your security group unless remote access is required
- Regular backups: Set up automated backups of both the WordPress files and MySQL database
- Secure credential files: Delete the password log files in
/stage/scripts/after noting the values - Hide WordPress version: Remove the generator meta tag to reduce information exposure
Support
If you encounter any issues with this product, contact cloudimg support:
- Email: support@cloudimg.co.uk
- Website: www.cloudimg.co.uk
- Support hours: 24/7 with guaranteed 24 hour response SLA