What is Wordpress?
WordPress is an open-source content management system (CMS) that powers approximately 40% of all websites on the internet. Its popularity stems from an intuitive user interface, thousands of customizable themes, and an extensive plugin ecosystem that enables users to add sophisticated functionality without requiring coding expertise. This flexibility makes WordPress suitable for diverse projects, from personal blogs and portfolio sites to complex e-commerce platforms and enterprise-level applications.
Hosting Considerations: Balancing Cost, Control, and Complexity
When it comes to hosting a WordPress site, users face several trade-offs between cost, control, and technical complexity:
Managed Hosting Solutions offer the easiest path forward, handling server management, security updates, and infrastructure maintenance. While convenient, these services can become expensive as your site scales and traffic increases.
Self-Hosting presents an attractive alternative for cost-conscious users, allowing complete control over the server environment and potentially significant savings. However, this approach comes with notable challenges:
- Reliability concerns: Personal hosting setups typically lack the redundancy and uptime guarantees of professional data centers
- Technical expertise required: Managing servers, security patches, backups, and troubleshooting requires substantial technical knowledge
- Time investment: Server maintenance can become a significant ongoing commitment
Cloud Hosting Solutions offer a middle ground, providing scalable infrastructure at competitive prices. However, they introduce their own learning curve, as cloud platforms often use specialized tools, interfaces, and deployment methods that differ significantly from traditional server management.
It can be challenging to choose a hosting approach that aligns with your technical expertise, budget constraints, and reliability requirements. Fortunately, there are tools available that help you gain the benefits of all these approaches.
Why Archil Makes the Difference
Archil bridges the gap between cost-effective cloud storage and user-friendly hosting by eliminating the traditional complexity of cloud platforms. Instead of wrestling with unfamiliar cloud interfaces and deployment processes, Archil allows you to leverage S3's scalable storage while interacting with it through a POSIX compliant file system interface.
Key advantages include:
- Mounted file system access: Copy, move, and manage files using familiar commands
- Zero code changes: WordPress plugins and themes work without modification
- Reduced latency: File system operations outperform API calls once cached
- Seamless workflow: No need to learn new interfaces or modify existing development processes
This solution is ideal for WordPress sites seeking S3's cost benefits without operational complexity. To mount an Archil disk to your EC2 instance, follow the Archil Getting Started Guide to create an Archil disk that will serve as the storage for your WordPress site.
Getting Started with Archil
To create a WordPress site using Archil, you'll need a few essential components:
- An AWS Account
- To create, go to the AWS Homepage and select “Create account”
- Follow the prompts until the account is set up
- A Linux AWS EC2 instance (this is just a virtual machine that you can interact with like a normal terminal)
- Access the AWS Management Console
- Search for EC2 in the top search bar and select it
- Select Launch Instance
- Select Amazon Linux as the AMI
- The rest is configurable with more information in the AWS documentation. However, as long as the instance is Amazon Linux it should work.
- Note: Since Archil handles storage management, you can minimize EBS storage allocation to reduce costs
- An S3 or S3 Compatible Storage Bucket (this is where we will store the WordPress site and any other files needed for it)
- Go to the AWS Management Console
- Go to S3 and select it
- The rest is configurable to however you would like, with more information in the AWS Documentation
- A WordPress Site
- Create a new site and develop your WordPress content locally
- Once ready, you'll deploy this site to your EC2 Instance with Archil
Migrate to EC2
- Find the root folder of your WordPress site and copy it to your EC2 instance:
scp -i /path/to/your-key.pem -r ./yourWordPressSite ec2-user@yourEc2PublicIp:~/wordPressSite- Connect to your EC2 instance:
ssh -i /path/to/your-key.pem ec2-user@yourEc2PublicIp- Install Apache, PHP, MySQL, and the required utilities:
sudo yum update -y
sudo yum install -y httpd php php-mysqlnd mariadb-server unzip- Start Apache and enable it at boot:
sudo systemctl start httpd
sudo systemctl enable httpd- Check the status of the service:
sudo systemctl status httpdIf the connection is healthy, the output should look similar to this:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: active (running)
Docs: man:httpd.service(8)
Main PID: 127349 (httpd)
Status: "Total requests: 0; Idle/Busy workers 100/0"
Tasks: 177
Memory: 13.0M
CPU: 77ms
CGroup: /system.slice/httpd.service
├─127349 /usr/sbin/httpd -DFOREGROUND
├─127350 /usr/sbin/httpd -DFOREGROUND
└─127351 /usr/sbin/httpd -DFOREGROUND- Set up the MySQL/MariaDB database (skip this step if the database is already configured).
Start and enable MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadbRun the secure installation flow:
sudo mysql_secure_installation- Press Enter if there is no root password yet
- Set a strong root password when prompted
- Answer the remaining security questions
Create a WordPress database and user:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'YourStrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;- Move the WordPress files to the web directory:
sudo cp -r ~/wordPressSite/* /var/www/html/
sudo chown -R apache:apache /var/www/html/
sudo chmod -R 755 /var/www/html/- Configure the WordPress database connection by opening the configuration file:
sudo nano /var/www/html/wp-config.phpUpdate the database settings with your actual values:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'YourStrongPassword123!');
define('DB_HOST', 'localhost');- Install the required PHP extensions:
sudo yum install -y php-gd php-xml php-mbstring php-json php-curl- Restart Apache and MariaDB:
sudo systemctl restart httpd
sudo systemctl restart mariadb- Test the database connection:
mysql -u wpuser -p'YourStrongPassword123!' \
-e "USE wordpress; SELECT 'Connection successful!' AS status;"-
Configure the EC2 security group:
- Go to the AWS EC2 Console
- Select your instance
- Open the Security tab
- Edit the inbound rules to allow HTTP (port 80) and HTTPS (port 443)
Troubleshooting Common Issues
- “Error establishing a database connection”: Check database credentials in wp-config.php and verify MySQL is running
- Permission denied errors: Ensure proper ownership with
sudo chown -R apache:apache /var/www/html/ - 404 errors: Check Apache configuration and ensure mod_rewrite is enabled
- PHP errors: Install missing PHP extensions and restart Apache
Congratulations! Your WordPress site should now be up and running. To view it, simply find the Public IPv4 address of your EC2 instance in the EC2 Console, paste it into your browser, and your WordPress site should appear.
Using Archil on Your WordPress Site to Host Static Images
At this point, you should have your Archil disk mounted to the EC2 instance. If you don’t, no worries. Just follow this quick tutorial. For the remainder of this tutorial, we will use /mnt/data as the root of the Archil disk.
Now, all you need to do is create a symbolic link between your old WordPress content store and your mounted bucket. This will seamlessly migrate your data from your wp-content folder to S3.
Note: Update the /mnt/data paths to match the mount location on your EC2 instance.
# Stop Apache to avoid file conflicts during the copy
sudo systemctl stop httpd
# Create the target directory in your Archil mount
mkdir -p /home/ec2-user/mnt/data/wp-content/uploads
# Copy existing uploads to Archil
if [ -d "/var/www/html/wp-content/uploads" ]; then
sudo cp -r /var/www/html/wp-content/uploads/* \
/home/ec2-user/mnt/data/wp-content/uploads/
fi
# Back up the original uploads directory
if [ -d "/var/www/html/wp-content/uploads" ]; then
sudo mv /var/www/html/wp-content/uploads \
"/var/www/html/wp-content/uploads.backup.$(date +%Y%m%d_%H%M%S)"
fi
# Link WordPress uploads to the Archil-backed directory
sudo ln -sfn /home/ec2-user/mnt/data/wp-content/uploads \
/var/www/html/wp-content/uploads
# Set ownership and permissions
sudo chown -R apache:apache /home/ec2-user/mnt/data/wp-content/
sudo chown -h apache:apache /var/www/html/wp-content/uploads
sudo usermod -a -G ec2-user apache
sudo chmod 755 /home/ec2-user
sudo chmod 755 /home/ec2-user/mnt/data
sudo chmod -R 755 /home/ec2-user/mnt/data/wp-content/
# Start Apache again
sudo systemctl start httpd
echo "Migration completed! Your uploads are now stored in Archil."As quickly as that, your finite local media store just became an infinitely scalable, highly reliable, S3-backed storage. If you go to S3 you should see all of your files uploaded there. As you add more items to your S3 bucket from S3 or locally, it will sync, letting you work on your WordPress site while Archil manages the rest.
With the symbolic link, you won’t even have to update your file paths within your WordPress site!
The Archil Advantage
Traditional cloud migration requires mastering multiple services, APIs, and unfamiliar infrastructure tools. Archil eliminates this barrier by presenting S3's enterprise-grade storage through a familiar file system interface.
The result? You get cloud-scale performance and cost savings while maintaining the straightforward development experience that makes WordPress so accessible. Simply mount your storage, deploy your site, and benefit from enterprise infrastructure without the enterprise complexity.