Web Servers & Stacks Intermediate 25 min

How to Install WordPress on Nginx with FastCGI Caching on Ubuntu 24.04

Achieve sub-second WordPress load times using server-level FastCGI page caching and Redis object caching

IndSoft Cloud Engineering
Reviewed October 2026
Production Verified Commands

Guide Overview & Architecture Outcome

By following this guide, you will deploy a high-performance WordPress site powered by Nginx and PHP 8.3. Server-side FastCGI caching will serve cached HTML pages in under 50 milliseconds directly from memory.

Prerequisites & System Requirements

An Ubuntu 24.04 VPS with LEMP stack installed. Recommended: IndSoft Managed WordPress Hosting.

1

Create Dedicated WordPress Database and User

Create an isolated database and grant permissions for your WordPress instance.

bash · step-1-command.sh
sudo mysql -u root -p CREATE DATABASE wp_production DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci; CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'SECURE_PASSWORD'; GRANT ALL ON wp_production.* TO 'wp_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
Expected System Output:
Query OK, 0 rows affected
2

Download and Extract Latest WordPress Core

Download the latest verified WordPress archive directly from wordpress.org.

bash · step-2-command.sh
cd /var/www sudo curl -O https://wordpress.org/latest.tar.gz sudo tar -xzvf latest.tar.gz sudo mv wordpress example.com sudo chown -R www-data:www-data /var/www/example.com sudo find /var/www/example.com/ -type d -exec chmod 755 {} \; sudo find /var/www/example.com/ -type f -exec chmod 644 {} \;
Expected System Output:
WordPress core files deployed with www-data ownership.
3

Configure Nginx FastCGI Microcache

Add fastcgi_cache_path to /etc/nginx/nginx.conf and configure caching rules in your server block.

bash · step-3-command.sh
sudo nano /etc/nginx/conf.d/fastcgi-cache.conf # fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m; sudo systemctl reload nginx
Expected System Output:
Cache zone initialized.

Check That It Worked (Verification)

Run this quick verification check to confirm your installation is responding properly:

verify-service.sh
curl -I https://example.com
Expected Response:
HTTP/2 200 server: nginx x-fastcgi-cache: HIT

Troubleshooting Common Errors

Quick resolutions for frequent setup pitfalls and configuration issues.

Diagnostic Tips
WordPress prompts for FTP credentials when uploading media
Fix directory ownership so the PHP-FPM process can write to wp-content: sudo chown -R www-data:www-data /var/www/example.com/wp-content.
404 errors on pretty permalinks
Ensure your Nginx location block includes: try_files $uri $uri/ /index.php?$args;.
FastCGI Cache status shows 'BYPASS' or 'MISS'
Check if cookies (e.g. comment_author or woocommerce_items_in_cart) are triggering cache skip rules in your Nginx config.