# Tutorial: Archil with Wordpress

Source: https://archil.com/article/wordpress-on-archil

Learn how to host and scale your WordPress site on AWS using Archil—mount S3 as a local file system for faster performance, simple deployment, and cost-efficient cloud storage without the complexity.

Hunter Leath · October 8, 2025

Archil now provides a managed bucket by default, so you don't need your own S3 bucket. Bringing your own bucket is still supported. See [Data sources](https://docs.archil.com/concepts/data-sources).

## What is Wordpress?

[WordPress](https://wordpress.com/) 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](https://archil.com/) 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](https://docs.archil.com/data-sources/s3-object-storage) 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](https://docs.archil.com/getting-started/quickstart) 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:

1. An AWS Account
   1. To create, go to the [AWS Homepage](https://aws.amazon.com/) and select “Create account”
   2. Follow the prompts until the account is set up
2. A Linux AWS EC2 instance (this is just a virtual machine that you can interact with like a normal terminal)
   1. Access the **AWS Management Console**
   2. Search for **EC2** in the top search bar and select it
   3. Select **Launch Instance**
   4. Select **Amazon Linux** as the AMI
   5. The rest is configurable with more information in the [AWS documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html). However, as long as the instance is **Amazon Linux** it should work.
   6. _Note: Since Archil handles storage management, you can minimize EBS storage allocation to reduce costs_
3. An S3 or S3 Compatible Storage Bucket (this is where we will store the WordPress site and any other files needed for it)
   1. Go to the **AWS Management Console**
   2. Go to **S3** and select it
   3. The rest is configurable to however you would like, with more information in the [AWS Documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html)
4. A WordPress Site
   1. Create a new site and develop your WordPress content locally
   2. Once ready, you'll deploy this site to your **EC2 Instance** with Archil

## Migrate to EC2

1. Find the root folder of your **WordPress** site and copy it to your **EC2 instance**:

```bash
scp -i /path/to/your-key.pem -r ./yourWordPressSite ec2-user@yourEc2PublicIp:~/wordPressSite
```

2. Connect to your EC2 instance:

```bash
ssh -i /path/to/your-key.pem ec2-user@yourEc2PublicIp
```

3. Install Apache, PHP, MySQL, and the required utilities:

```bash
sudo yum update -y
sudo yum install -y httpd php php-mysqlnd mariadb-server unzip
```

4. Start Apache and enable it at boot:

```bash
sudo systemctl start httpd
sudo systemctl enable httpd
```

5. Check the status of the service:

```bash
sudo systemctl status httpd
```

If the connection is **healthy**, the output should look similar to this:

```text
● 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
```

6. **Set up the MySQL/MariaDB database** (skip this step if the database is already configured).

Start and enable MariaDB:

```bash
sudo systemctl start mariadb
sudo systemctl enable mariadb
```

Run the secure installation flow:

```bash
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:

```sql
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'YourStrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```

7. **Move the WordPress files to the web directory**:

```bash
sudo cp -r ~/wordPressSite/* /var/www/html/
sudo chown -R apache:apache /var/www/html/
sudo chmod -R 755 /var/www/html/
```

8. **Configure the WordPress database connection** by opening the configuration file:

```bash
sudo nano /var/www/html/wp-config.php
```

Update the database settings with your actual values:

```php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'YourStrongPassword123!');
define('DB_HOST', 'localhost');
```

9. **Install the required PHP extensions**:

```bash
sudo yum install -y php-gd php-xml php-mbstring php-json php-curl
```

10. **Restart Apache and MariaDB**:

```bash
sudo systemctl restart httpd
sudo systemctl restart mariadb
```

11. **Test the database connection**:

```bash
mysql -u wpuser -p'YourStrongPassword123!' \
  -e "USE wordpress; SELECT 'Connection successful!' AS status;"
```

12. **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](https://docs.archil.com/getting-started/quickstart). 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._

```bash
# 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.
