Application Stacks Azure

WordPress with Redis Object Cache on Ubuntu 24.04 on Azure User Guide

| Product: WordPress with Redis Object Cache on Ubuntu 24.04 LTS on Azure

Overview

WordPress is the world's most-deployed content management system, powering a large share of the public web. This cloudimg image pairs WordPress with a Redis object cache so repeated database queries are served from memory — WordPress feels faster and the database does less work as traffic grows. The stack is Apache 2.4, MySQL 8.0, PHP 8.3 and Redis, all from Ubuntu 24.04 noble universe (no third-party APT repositories). Per-VM MySQL root, WordPress database, WordPress admin and Redis passwords are rotated at first boot via openssl rand -hex 16.

What is included:

  • WordPress (latest stable at build time) from the official wordpress.org tarball at /var/www/html/wordpress
  • Redis Object Cache plugin (GPLv3) activated with the object-cache.php drop-in enabled
  • Redis 7.0.x (BSD-3-Clause — the community/BSD Redis, not the RSALv2/SSPL upstream) bound to 127.0.0.1 with a per-VM password
  • Apache 2.4.x with mod_rewrite, vhost at /etc/apache2/sites-available/wordpress.conf
  • MySQL 8.0.x with wordpress DB and wpuser MySQL user (per-VM password)
  • PHP 8.3.x with the PhpRedis extension plus mysqli, gd, mbstring, xml, curl, zip, imagick
  • WP-CLI 2.x at /usr/local/bin/wp
  • wordpress-redis-firstboot.service rotating all passwords, wiring the cache, and creating the cloudimg admin user
  • Apache, MySQL and Redis enabled and auto-starting on boot
  • 24/7 cloudimg support

Prerequisites

Active Azure subscription, SSH key, VNet + subnet. Standard_B2s (4 GB RAM) is a good starting point; bump to D2s/D4s for high-traffic sites or WooCommerce stores.

Step 1-3: Deploy + SSH (standard pattern)

ssh azureuser@<public-ip>

Step 4: Verify Services

sudo systemctl is-active apache2.service mysql.service redis-server.service
sudo ss -tln | grep -E ':(80|3306|6379) '
curl -s -o /dev/null -w 'wordpress http / -> %{http_code}\n' http://127.0.0.1/

Apache, MySQL and Redis are all active. Port 80 serves the site; MySQL (3306) and Redis (6379) listen on loopback only.

apache2, mysql and redis-server active; site returns HTTP 200; MySQL and Redis on loopback

Step 5: Confirm the Redis Object Cache

cd /var/www/html/wordpress
sudo -u www-data /usr/local/bin/wp core version --allow-root
sudo -u www-data /usr/local/bin/wp redis status --allow-root | grep -E 'Status:|Client:|Drop-in:|Redis Version:'

Status: Connected and Drop-in: Valid confirm WordPress is serving its object cache from Redis via PhpRedis. Redis requires the per-VM password, so an unauthenticated redis-cli ping is rejected.

wp redis status reports Connected, Drop-in Valid, PhpRedis client, Redis 7.0.15; unauthenticated redis ping rejected

Step 6: Read the Per-VM Credentials

sudo stat -c 'mode %a owner %U:%G' /stage/scripts/wordpress-redis-credentials.log
sudo cat /stage/scripts/wordpress-redis-credentials.log

The file is 0600 root:root and holds this instance's unique WP_ADMIN_PASSWORD, WP_ADMIN_URL, database and Redis passwords. Nothing ships with a known password — the WordPress admin is created per-VM at first boot, and blank or common default passwords are rejected.

credentials file 0600 root:root; per-VM WordPress admin accepted, blank/admin/password rejected; only the cloudimg administrator is seeded

Step 7: Component Versions

cd /var/www/html/wordpress
sudo -u www-data /usr/local/bin/wp core version --allow-root
php -v | head -1
mysql --version
redis-server --version | grep -oE 'v=[0-9.]+'

WordPress, PHP 8.3, MySQL 8.0, Redis 7.0 versions and the first-boot service active

Step 8: Front-End

Browse to http://<public-ip>/ to see the WordPress front-end with the default sample content.

WordPress front-end rendered on the default theme

Step 9: Login to wp-admin

Browse to http://<public-ip>/wp-admin/ (or /wp-login.php) and authenticate as cloudimg with the WP_ADMIN_PASSWORD from Step 6.

WordPress login screen at /wp-login.php

Step 10: Dashboard

The dashboard shows site activity, recent comments, drafts and quick-publish.

WordPress dashboard for the cloudimg administrator

Step 11: Redis Object Cache Admin

Go to Settings → Redis to see the object cache status, flush the cache, or review metrics. Status Connected and Redis Reachable confirm the cache is live.

Redis Object Cache admin page: Status Connected, Redis Reachable, PhpRedis client, Redis 7.0.15

Step 12: Components

Component Path
WordPress install /var/www/html/wordpress/
wp-config.php /var/www/html/wordpress/wp-config.php
Object cache drop-in /var/www/html/wordpress/wp-content/object-cache.php
Redis Object Cache plugin /var/www/html/wordpress/wp-content/plugins/redis-cache/
Redis config /etc/redis/redis.conf (loopback, per-VM requirepass)
Apache vhost /etc/apache2/sites-available/wordpress.conf
Apache logs /var/log/apache2/wordpress-{access,error}.log
MySQL data /var/lib/mysql/
WP-CLI /usr/local/bin/wp
Firstboot script /usr/local/sbin/wordpress-redis-firstboot.sh
Credentials /stage/scripts/wordpress-redis-credentials.log (mode 0600 root:root)

Step 13: Security & Tuning

  • HTTPS: install certbot and obtain a Let's Encrypt cert: sudo apt-get install -y certbot python3-certbot-apache && sudo certbot --apache
  • Set your real domain: sudo -u www-data wp option update home 'https://your-domain' and ... siteurl 'https://your-domain' (or use the General settings screen)
  • Restrict the NSG so port 80/443 is open to your CDN / load balancer only; keep 22 to your management CIDR
  • Tune the cache: adjust maxmemory in /etc/redis/redis.conf (ships at 128mb, allkeys-lru) for larger working sets; flush via Settings → Redis → Flush Cache
  • Update plugins/themes monthly via wp plugin update --all and wp theme update --all
  • Enable two-factor auth via the Wordfence or Two Factor Authentication plugin
  • Patch monthly: sudo apt-get update && sudo apt-get upgrade && sudo reboot

Licensing

WordPress core is GPL-2.0+ and the Redis Object Cache plugin is GPLv3 — both free to use commercially. The bundled Redis server is Ubuntu 24.04's redis-server 7.0.x, which is BSD-3-Clause (the community/BSD Redis, not the RSALv2/SSPL upstream Redis 7.4+). cloudimg provides commercial support separately. support@cloudimg.co.uk.