WordPress Redis
Overview
WordPress is the world's most-deployed content management system, powering a large share of the public web. This SecureAnyCloud image pairs WordPress with a Redis object cache on Ubuntu 24.04 on Azure. Repeated database queries are served from memory, so 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, with no third-party APT repositories. First boot generates the per-VM MySQL root, WordPress database, WordPress admin, Redis and MySQL maintenance (debian-sys-maint) passwords, and all eight WordPress authentication keys and salts. MySQL also generates its own TLS and RSA keys on that boot, so no two VMs share a secret.
What you get:
- WordPress 7.1 from the official wordpress.org tarball (verified against its published checksum) at
/var/www/html/wordpress, with WordPress's default automatic updates left on. - Redis Object Cache plugin 2.8.0 (GPLv3, every file verified against wordpress.org's checksums), activated with the
object-cache.phpdrop-in enabled. - Redis 7.0.x (BSD-3-Clause: the community/BSD Redis, not the RSALv2/SSPL upstream) bound to
127.0.0.1with a per-VM password. - Apache 2.4.x with mod_rewrite, and a vhost at
/etc/apache2/sites-available/wordpress.conf. - MySQL 8.0.x with the
wordpressdatabase and thewpuserMySQL user (per-VM password). - PHP 8.3.x with the PhpRedis extension plus mysqli, gd, mbstring, xml, curl and zip. WordPress resizes images with PHP's GD library. ImageMagick is not installed.
- WP-CLI 2.x at
/usr/local/bin/wp. - wordpress-redis-firstboot.service, which rotates all passwords, wires up the cache and creates the SecureAnyCloud admin user.
- Apache, MySQL and Redis
enabledand starting automatically on boot. - 24/7 SecureAnyCloud support.
Prerequisites
- An active Azure subscription, an SSH key, and a VNet and subnet.
- Standard_B2s (4 GB RAM) as a starting VM size. Move to D2s or D4s for high-traffic sites or WooCommerce stores.
Step 1-3: Deploy and connect over SSH
Deploy the VM from Azure Marketplace with your SSH key, then connect as the administrator user:
ssh azureuser@<public-ip>Verify services
Check that the three services are active, that only the expected ports listen and that the site answers locally:
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.
Confirm the Redis object cache
Check the WordPress version and the object cache status with WP-CLI:
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 that WordPress serves its object cache from Redis through PhpRedis. Redis requires the per-VM password, so it rejects an unauthenticated redis-cli ping.
Read the per-VM credentials
Check the credentials file permissions, then read it:
sudo stat -c 'mode %a owner %U:%G' /stage/scripts/wordpress-redis-credentials.log
sudo cat /stage/scripts/wordpress-redis-credentials.logThe file is 0600 root:root and holds this instance's unique WP_ADMIN_PASSWORD, WP_ADMIN_URL, database password and Redis password. Nothing ships with a known password. First boot creates the WordPress admin for each VM, and blank or common default passwords are rejected.
Check component versions
Print the installed versions of WordPress, PHP, MySQL and Redis:
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.]+'Open the front end
Browse to http://<public-ip>/ to see the WordPress front end with the default sample content.
Sign in to wp-admin
Browse to http://<public-ip>/wp-admin/ (or /wp-login.php) and sign in as SecureAnyCloud with the WP_ADMIN_PASSWORD from Step 6.
Open the dashboard
The dashboard shows site activity, recent comments and a quick-publish box.
Manage the Redis object cache
Go to Settings, then Redis, to see the object cache status, flush the cache or review metrics. Status Connected and Redis Reachable confirm that the cache is live.
Find the key files and paths
- 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
- First-boot script: /usr/local/sbin/wordpress-redis-firstboot.sh
- Credentials: /stage/scripts/wordpress-redis-credentials.log (mode 0600 root:root)
Security and tuning
- HTTPS: install certbot and obtain a Let's Encrypt certificate with
sudo apt-get install -y certbot python3-certbot-apache && sudo certbot --apache. - Set your real domain: run
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 or load balancer only, and keep 22 limited to your management CIDR.
- Tune the cache: for larger working sets, adjust
maxmemoryin/etc/redis/redis.conf(it ships at 128mb,allkeys-lru). Flush the cache with Settings, Redis, Flush Cache. - Update plugins and themes monthly with
wp plugin update --allandwp theme update --all. - Enable two-factor authentication with the Wordfence or Two Factor Authentication plugin.
- Patch monthly: run
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 are 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+). SecureAnyCloud provides commercial support separately. Contact sales@secureanycloud.com.
Deploy on Azure
Launch WordPress with Redis Object Cache on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com