Search This Blog

Wednesday, November 4, 2026

Deploying High-Performance WordPress on OCI: Ubuntu 26.04 LTS + Nginx + MySQL HeatWave

Running WordPress on cloud infrastructure doesn't need to be overly complex. While many enterprise architectures rely on multiple compute nodes, load balancers, and internal proxy layers, you can achieve outstanding performance, security, and low latency using a streamlined, simple architecture in Oracle Cloud Infrastructure (OCI).

In this guide, we will set up a high-performance, lightweight WordPress deployment on OCI using:

  • Compute / App Server: An Ampere A1 Compute Instance running Ubuntu 26.04 LTS.
  • Web Server Stack: Nginx paired with PHP-FPM.
  • Database: A managed Oracle MySQL HeatWave Database Instance.
  • CMS: The latest stable release of WordPress.

By bypassing heavy load balancers and extra proxy layers like MySQL Router, our application server connects directly to the MySQL HeatWave DB endpoint over Oracle’s private Virtual Cloud Network (VCN).


1. Prerequisites & Network Setup

Before spinning up your services, ensure your OCI Virtual Cloud Network (VCN) has two key subnets:

  1. Public Subnet: Hosts your Ampere Ubuntu compute instance (assigning a public IP for HTTP/HTTPS web traffic).
  2. Private Subnet: Hosts your MySQL HeatWave instance to ensure the database is never directly exposed to the public internet.

Ensure your Security Lists allow:

  • Inbound TCP traffic on ports 80 (HTTP) and 443 (HTTPS) for the Public Subnet.
  • Inbound TCP traffic on port 3306 (MySQL) within the VCN CIDR (e.g., 10.0.0.0/16) for the Private Subnet.

2. Deploying MySQL HeatWave DB System

  1. In the OCI Console, navigate to Databases > MySQL HeatWave.
  2. Click Create DB System.
  3. Select your compartment, set a system name, and choose HeatWave as the system type.
  4. Set up an administrator username and a secure password.
  5. Place the DB system in your Private Subnet.
  6. Once deployed, note down the internal IP address of your primary MySQL HeatWave endpoint (e.g., 10.0.2.50).

3. Provisioning the Ampere Compute Instance (Ubuntu 26.04 LTS)

  1. Navigate to Compute > Instances > Create Instance.
  2. Select Ubuntu 26.04 LTS (Arm64) as your Image.
  3. Choose the Ampere A1 Compute (ARM-based) shape.
  4. Place it in your Public Subnet and add your SSH public key.
  5. Once running, SSH into your instance:
ssh -i /path/to/your_key ubuntu@<YOUR_PUBLIC_IP>

4. Installing Nginx and PHP-FPM Stack

Update package indices and install Nginx, PHP-FPM, and necessary extensions:

sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx php-fpm php-mysql php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip unzip

Verify that services are running and adjust your UFW firewall:

sudo systemctl status nginx
sudo systemctl status php-fpm

sudo ufw allow 'Nginx Full'
sudo ufw allow OpenSSH
sudo ufw enable

5. Creating the WordPress Database and User

Connect directly to your MySQL HeatWave instance from the Ubuntu application server:

sudo apt install -y mysql-client
mysql -h 10.0.2.50 -u admin -p

Run the following SQL commands inside the MySQL console:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'%' IDENTIFIED BY 'YourSecurePassword123!';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'%';
FLUSH PRIVILEGES;
EXIT;

6. Downloading and Configuring WordPress

Fetch the latest stable WordPress tarball and extract it to /var/www/:

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo mv wordpress /var/www/wordpress

sudo chown -R www-data:www-data /var/www/wordpress
sudo chmod -R 755 /var/www/wordpress

Configure your wp-config.php file:

cd /var/www/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Update your database definitions:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wp_user' );
define( 'DB_PASSWORD', 'YourSecurePassword123!' );
define( 'DB_HOST', '10.0.2.50' );

7. Configuring Nginx for WordPress & PHP-FPM

Create a custom Server Block file for WordPress:

sudo nano /etc/nginx/sites-available/wordpress

Paste the following configuration:

server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/wordpress;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;
    }

    location ~ /\.ht {
        deny all;
    }
}

Enable the site configuration and restart Nginx:

sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx

8. Completing the Setup

Open your browser and navigate to your server's public IP or domain name (http://yourdomain.com) to complete the installation wizard.

Key Architecture Takeaways:

  • Simple Design: 1 Application Server + 1 Managed MySQL HeatWave Instance. No complex routers or load balancers required.
  • High Performance: Ubuntu 26.04 paired with Nginx and PHP-FPM ensures minimal overhead and rapid page load speeds.

Reference: WordPress in OCI with MySQL HeatWave Read Replicas and MySQL Router R/W Splitting

No comments:

Post a Comment