WordPress
Overview
WordPress is the world's most popular content management system (CMS), powering websites, blogs and online stores.
This guide covers deploying and configuring WordPress on Linux from the SecureAnyCloud AMI on AWS Marketplace.
What you get:
- WordPress with preconfigured database connectivity.
- A MySQL database server with a dedicated storage volume.
- Apache HTTP Server (httpd) for serving web content.
- The PHP runtime environment.
- Randomly generated database credentials.
- An 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.
- The latest security patches, applied at build time.
- 24/7 SecureAnyCloud support with a guaranteed 24-hour response SLA.
Prerequisites
Before you launch this AMI, make sure 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.
Launch the AMI
- Go to AWS Marketplace and search for "WordPress SecureAnyCloud".
- Click Continue to Subscribe, accept the terms, then click 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.smallis recommended). - Configure storage with a minimum of 20 GB gp3.
- Configure your Security Group with the inbound rules listed below.
- Port 22, TCP, source your IP: SSH access.
- Port 80, TCP, source 0.0.0.0/0: WordPress site (HTTP).
- Port 443, TCP, source 0.0.0.0/0: WordPress site (HTTPS, if configured).
- Port 3306, TCP, source your IP: MySQL database (remote access, optional).
Important: Open port 3306 only if you need remote database access. For most deployments, MySQL is accessed locally and this port should stay closed.
- Select your EC2 key pair and launch the instance.
Connect via SSH
When your instance is running and has passed both status checks (2/2), connect over 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 you connect. If you connect too early, you may see an error such as:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).To switch to the root user:
sudo su -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.logWordPress database password:
cat /stage/scripts/mysql_wordpress_password.logNote: The MySQL root user is disabled for remote login, as a security best practice. Only local connections from the server command line are permitted.
Complete the WordPress Setup Wizard
The Apache HTTP server starts automatically on boot, so WordPress is accessible immediately. Open this address in your browser:
http://<public-ip-address>/wp-adminThe WordPress setup wizard opens. Work through it as follows:
- Select your language and click Continue.
- Enter the site information:
- Site Title: your website name.
- Username: choose an admin username.
- Password: set a strong password and make a note of it.
- 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
- MySQL: configuration in /etc/my.cnf.
- Apache: configuration in /etc/httpd or /etc/apache2.
- PHP: configuration in /etc/php.ini.
- WordPress: installed in /var/www/html/.
Note: The automatic OS package update script may update component versions on first boot.
Filesystem Layout
The image has these mount points:
- / (38 GB): the root filesystem.
- /boot (2 GB): the operating system kernel files.
- /var/lib/mysql (9.8 GB): the MySQL database data directory.
- /var/www/html (9.8 GB): the WordPress site root.
Key directories:
- /var/www/html: the 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: the WordPress database and configuration file.
- /var/lib/mysql: the MySQL database files.
- /etc/httpd/conf: the Apache configuration (RedHat based).
- /etc/apache2: the Apache configuration (Debian based).
Managing Services
MySQL:
service mysqld status service mysqld stop service mysqld startApache HTTP Server (RedHat based):
systemctl status httpd
systemctl stop httpd
systemctl start httpdApache HTTP Server (Debian based):
systemctl status apache2
systemctl stop apache2
systemctl start apache2Access the MySQL command line:
mysql -u root -p
# Enter the password from /stage/scripts/mysql_root_password.logCheck PHP version:
php -vScripts and Log Files
All of these files are in /stage/scripts:
- initial_boot_update.sh: updates the OS with the latest packages on first boot.
- initial_boot_update.log: the output log for the boot update script.
- mysql_root_password.log: the MySQL root database password.
- mysql_wordpress_password.log: the WordPress database user password.
On Startup
An OS package update script runs on first boot to make sure the image is fully up to date. To disable it, remove 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.shTroubleshooting
Cannot access WordPress on port 80
- Verify that Apache is running:
systemctl status httpdorsystemctl status apache2 - Check that your security group allows inbound traffic on port 80.
- Make sure the instance has passed 2/2 status checks.
- Check the Apache error logs:
tail -f /var/log/httpd/error_log
Database connection error on WordPress
- Verify that MySQL is running:
service mysqld status - Check that the credentials in
/var/www/html/wp-config.phpmatch those in the log files. - Test the database connection:
mysql -u root -p - Check the MySQL error logs:
tail -f /var/log/mysqld.log
WordPress shows "Error establishing a database connection"
- Restart MySQL:
service mysqld restart - Verify that the WordPress database exists:
mysql -u root -p -e "SHOW DATABASES;" - Check disk space:
df -h /var/lib/mysql
Cannot upload media files
- Check the PHP upload limits in
/etc/php.ini. The relevant settings areupload_max_filesize(the default may be 2M) and post_max_size. - Check the directory permissions:
ls -la /var/www/html/wp-content/uploads/ - Make sure Apache has write access:
chown -R apache:apache /var/www/html/wp-content/uploads/
Security Recommendations
- Change the database passwords. Update the MySQL root and WordPress database passwords after deployment.
- Enable HTTPS. Install an SSL certificate with Let's Encrypt (
certbot) for encrypted connections. - Keep WordPress updated. Update WordPress core, themes and plugins regularly 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 you need remote access.
- Back up regularly. Set up automated backups of both the WordPress files and the MySQL database.
- Secure the credential files. Delete the password log files in
/stage/scripts/after you note the values. - Hide the WordPress version. Remove the generator meta tag to reduce information exposure.
Support
If you have any issues with this product, contact SecureAnyCloud support:
- Email: sales@secureanycloud.com
- Website: secureanycloud.com
- Support hours: 24/7, with a guaranteed 24-hour response SLA.
Deploy on AWS
Launch WordPress with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com