This tutorial shows you how to set up Nginx FastCGI Cache + Redis Object Cache + Cloudflare CDN, get 100% GTmetrix scores.
Demo domain: blogwp.ovh
Demo Theme: Divi Theme
The VPS used in this article: Vultr (1GB RAM, 1 vCore)
Get $100 of free Vultr credits if you sign up through this link!
Please add your domain name to Cloudflare in advance.
Please resolve your domain name to an IP address in advance.
Please replace blogwp.ovh with your own domain name.
Nginx FastCGI Cache is NGINX server-side page caching. You will need a VPS / Dedicated server to use Nginx FastCGI Cache. When using regular shared hosting, Nginx FastCGI Cache is not available. With the correct settings, the performance of server-side page caching can be better than any WordPress caching plugin.
Redis Object Cache can improve WordPress backend performance.
You can use WordOps or Webinoly to install Nginx FastCGI Cache + Redis Object Cache.

You can read these 2 articles for a detailed installation of WordOps and Webinoly




Method 1: Install Nginx FastCGI Cache + Redis Object Cache in WordOps
1、Install WordOps
wget -qO wo wops.cc && sudo bash wo
[email protected]:~# wget -qO wo wops.cc && sudo bash wo
Welcome to WordOps install/update script v3.13.2
Installing wo dependencies [OK]
Installing WordOps [OK]
Running post-install steps [OK]
WordOps (wo) require an username & and an email address to configure Git (used to save server configurations)
Your informations will ONLY be stored locally
Enter your name: blogwpwpblog
Enter your email: [email protected]
Synchronizing wo database, please wait...
WordOps (wo) installed successfully
To enable bash-completion, just use the command:
bash -l
To install WordOps recommended stacks, you can use the command:
wo stack install
To create a first WordPress site, you can use the command:
wo site create site.tld --wp
WordOps Documentation : https://docs.wordops.net
WordOps Community Forum : https://community.wordops.net
WordOps Community Chat : https://chat.wordops.net
Give WordOps a GitHub star : https://github.com/WordOps/WordOps/
Note:
Please replace blogwpwpblog with your own name, it stands for your WordPress admin user name
Please replace [email protected] with your own email
2、Install WordPress + FastCGI Cache
wo site create blogwp.ovh --wpfc
[email protected]:~# wo site create blogwp.ovh --wpfc
Start : wo-kernel [OK]
Adding repository for MySQL, please wait...
Adding repository for NGINX, please wait...
Adding repository for PHP, please wait...
Updating apt-cache [OK]
Installing APT packages [OK]
Applying Nginx configuration templates
Testing Nginx configuration [OK]
Restarting Nginx [OK]
Testing Nginx configuration [OK]
Restarting Nginx [OK]
Configuring php7.3-fpm
Restarting php7.3-fpm [OK]
Tuning MySQL configuration [OK]
Restarting mysql [OK]
Running pre-update checks [OK]
Setting up NGINX configuration [Done]
Setting up webroot [Done]
Downloading WordPress [Done]
Setting up database [Done]
Configuring WordPress [OK]
Installing WordPress [OK]
Installing plugin nginx-helper [OK]
Setting plugin nginx-helper [OK]
Testing Nginx configuration [OK]
Reloading Nginx [OK]
HTTP Auth User Name: WordOps
HTTP Auth Password : C7OfY8M43X4mFzPwbhS9SREf
WordOps backend is available on https://107.191.45.165:22222 or https://vultr.guest:22222
WordPress admin user : blogwpwpblog
WordPress admin password : 5YL9FJirHPTduewOIUtjsfMk
Nginx-Helper configuration : http://blogwp.ovh/wp-admin/options-general.php?page=nginx
Successfully created site http://blogwp.ovh
You need “Nginx Helper” plugin to automatically clear the Nginx FastCGI Cache.
Nginx Helper Plugin Settings ( When You use WordOps )
The “Caching Method” should be set to “Nginx FastCgi Cache”.
The Purge Method should be set to “Using a GET request to PURGE/url”.
3、Install Redis Object Cache, In step 2, When you execute this command:
wo site create blogwp.ovh --wpfc
Nginx FastCGI Cache has been installed, but if you want to do FastCGI for the Page Cache and Redis for Object Cache, You need to execute the following command:
wo stack install --redis
[email protected]:~# wo stack install --redis
Adding repository for Redis, please wait...
Updating apt-cache [OK]
Installing APT packages [OK]
Tuning Redis configuration [OK]
Restarting redis-server [OK]
Successfully installed packages
Additionally, you need to install “Redis Object Cache” plugin to automatically clear the object cache.
Method 2: Install Nginx FastCGI Cache + Redis Object Cache in Webinoly
1、Quick Setup, install LEMP Stack
wget -qO weby qrok.es/wy && sudo bash weby 3
MySQL has been installed successfully!
phpMyAdmin has been installed successfully!
****************************************************************************
****** INSTALLATION HAS FINISHED SUCCESSFULLY ******
****************************************************************************
******** Save your DB access password in a secure place: ********
****** root: PVRVLr0iPPuquM1I admin: CQtXzLo0D45yGOZG ******
****************************************************************************
****************************************************************************
************************ D O N A T I O N S *************************
*** If you like Webinoly, buy me a coffee or a beer to show support. ***
****************************************************************************
************* Bitcoin: 1E3Ybo5UcvaAr1MoK4nBnMRFFY9aEMiku3 **********
******* GitHub Sponsors: https://github.com/sponsors/QROkes **********
*************** PayPal: https://www.paypal.me/qrokes ****************
****************************************************************************
*** Your regular donations is what keep this project moving forward. ***
****************************************************************************
2、Install WordPress, enable Nginx FastCGI Cache + Redis Object Cache
sudo site blogwp.ovh -wp -cache=on
[email protected]:~# sudo site blogwp.ovh -wp -cache=on
Downloading WordPress...
[WARNING] HTTP Authentication Credentials not found and you may need it to complete the WordPress installation process!!
[WARNING] Login for www-data is not enabled and you may need it to upload your site files!
Nginx Helper Plugin has been installed!
Please, activate this plugin for a better experience with FastCgi Cache.
** IMPORTANT - Plugin Settings **
- The “Caching Method” should be set to “Nginx FastCgi Cache”.
- Support for purge/url method is a premium feature only included in NGINX Plus (not-free) and we recommend not to trust in solutions or tools that use third-party NGINX modules to offer this feature.
- The Purge Method should be set to “Delete local server cache file”.
Redis Object Cache Plugin has been installed!
Please, activate this plugin for a better experience with WordPress Object Cache.
** IMPORTANT - Plugin Settings **
- Go to “Menu > Settings > Redis” and be sure that Object Cache is enabled.
WordPress Cache successfully enabled!
Site blogwp.ovh has been successfully created!
You need “Nginx Helper” plugin to automatically clear the Nginx FastCGI Cache.
Nginx Helper Plugin Settings ( When You use Webinoly )
The “Caching Method” should be set to “Nginx FastCgi Cache”.
The Purge Method should be set to “Delete local server cache file”.
Install Divi Theme, under the Theme Options, enable Minify And Combine Javascript Files, enable Minify And Combine CSS Files, enable Static CSS File Generation.
I use Query Monitor WordPress plugin to monitor the number of database queries.
Database query time in WordPress dashboard page before install Redis Object Cache
Database query time in WordPress dashboard page after install Redis Object Cache. The database queries reduce from 83Q to 6Q queries.
Database query time in WordPress homepage before install Redis Object Cache
Database query time in WordPress homepage after install Redis Object Cache. The database queries reduce from 33Q to 4Q queries.
Cloudflare CDN Settings:
When you use Cloudflare CDN, by default it only cache the static files like images, CSS, JavaScript etc, it doesn’t cache HTML pages. If you want to make your site faster, you need to use Cloudflare page rule feature to cache HTML pages.
Because blogwp.ovh is a demo site, I didn’t install Let’s Encrypt’s SSL certificates. So when you use Cloudflare SSL, then the SSL/TLS encryption mode should be set to “Flexible”
Click the ‘SSL/TLS’ section, click the Edge Certificates tab, toggle the Always Use HTTPS switch to On.
Click the ‘Speed’ section, click the Optimization tab, turn Auto Minify on, toggle the Brotli switch to On.
Click the ‘Caching’ section, click the Configuration tab. Under Browser Cache TTL section, set the option to Respect Existing Headers.
Click the ‘Network’ section, toggle the HTTP/3 (with QUIC) switch to On, toggle the 0-RTT Connection Resumption switch to On, toggle the gRPC switch to On, toggle the WebSockets switch to On.
The following steps are the most important part: Set up cache everything page rule in Cloudflare, this can greatly speed up your WordPress website.
Note: Set up cache everything page rule can cause several problems, such as the WordPress admin bar will show if the user is logged in. The new comments will not be visible unless you clear the cache. The comment area will caches the WordPress login user name like the image shows.
But don’t worry, the next step is to show you how to solve these problems. But don’t worry, the next step is to show you how to solve these problems.
Method:
First of all, make sure the ‘Browser Cache TTL’ in the ‘Caching’ section is set to ‘Respect Existing Headers’.
Then install WP Cloudflare Super Page Cache plugin. WP Cloudflare Super Page Cache plugin allows you to bypass the cache for logged in users even on free plan, this means that WP admin bar will not be cached. It can also automatically clean up the cache on website changes.
WP Cloudflare Super Page Cache Plugin Settings:
1. Enter your Cloudflare’s API key and e-mail
2. Select from the dropdown menu the domain for which you want to enable the cache
3. Enable Page Caching
4. Test Cache
When the settings are complete, WP Cloudflare Super Page Cache Plugin will automatically adds a cache everything page rule under Page Rules section.
When you correctly set up WP Cloudflare Super Page Cache plugin, the above annoying problems will be solved.
More methods
Load Test before install Nginx FastCGI Cache + Redis Object Cache (tool: https://loader.io/)
Load Test after install Nginx FastCGI Cache + Redis Object Cache (tool: https://loader.io/)
I use KeyCDN’s performance tool to measure the TTFB
The TTFB before settings
The TTFB after settings
Speed Tests Results
GTmetrix:
The speed optimization method can be summarized as: Nginx FastCGI Cache + Redis Object Cache + Nginx Helper + WP Cloudflare Super Page Cache + Cloudflare CDN
If you have any questions, please leave me a comment.