Fix Nginx Helper FastCGI Disk Cache Not Purge Issue | Custom Path

Nginx WordPress FastCGI Custom Cache Path

FastCGI is one of the best caching solutions for Nginx servers. This server-level caching is more powerful than the general WordPress plugin cache. One of the issues with Nginx FastCGI with WordPress is clearing its cache. Open source Nginx does not have a default option to delete the FastCGI cache when the site content is updated.

For this, we have to use 3rd party module with a WordPress plugin. I assume that you have already compiled the Nginx with the required 3rd party modules. If you use WordOps, Webinnoly, Centmin Mod, or a similar script to set up LEMP stack on your server you already have an Nginx cache purge module. Alternatively, if you use my previous Nginx, PagespeedMo, and Brotil installation guide you already have a cache purge module.

Now you have already built Nginx with the FastCGI cache purge module. If you have a server with multiple WordPress sites hosted, when one site content gets updated, you have to purge only on that site. Therefore it is useless to wipe the entire FastCGI cache directory.

Nginx Helper is one of the good solutions to purge multi-site server FastCGI cache. This plugin can purge only a selected site cache. However, if you use FastCGI disk cache, this plugin does not work out of the box. You have to make a few configurations on your WordPress site as well as server level.


Table of Contents

How To Fix WordPress Nginx Helper Plugin Not Purge FastCGI Disk Cache Issue.


When you use a FastCGI custom cache path, the Nginx helper plugin does not work. We have to make a few changes to your wp-config file as well as the php.ini file.

How to configure WordPress Nginx helper plugin to use custom FastCGI cache path.

The default location is “/var/run/nginx/”, however, if you use anything other than this location, we have to change it in FastCGI.conf as well as WordPress wp-config.php.

Open the wp-config.php file and add the following line before the “/* That’s all, stop editing! Happy publishing. */“.

/**Nginx Helper Cache Path*/
define( 'RT_WP_NGINX_HELPER_CACHE_PATH','/var/cache/nginx/');


WordPress Nginx Helper Custom FastCGI Cache
WordPress Config file set Custom FastCGI Cache path.

Now the plugin is ready to purge the WordPress FastCGI cache. However, if you do not allow PHP to access the specified custom cache path this plugin shows the following error (if you enable WordPress debugging).

PHP Warning: is_dir(): open_basedir restriction in effect. File(/var/run/nginx-cache) is not within the allowed path(s): (/var/www/:/usr/share/php/:/tmp/:/var/run/nginx-cache/:/dev/urandom:/dev/shm:/var/lib/php/sessions/)


Deploy your first high performance SSD cloud server @UpCloud today! Get a $25 bonus when signing up with this link.


Configure Nginx Helper Plugin to use Custom FastCGI cache.

Navigate to WordPress “Settings>Nginx Helper” and change the settings as below.

  • Caching Method: Nginx Fastcgi cache.
  • Purge Method: Using a GET request to PURGE/url (Default option)


Nginx Helper Plugin Configure
Nginx Helper Plugin Configuration


How to fix PHP Warning: is_dir(): open_basedir restriction in effect.

Open your www.conf file. Ubuntu servers this location is “/etc/php/<<php version>>/fpm/pool.d/”. Using SSH or SFTP client navigate to the PHP installation directory.

  • For php7.8 it is “/etc/php/7.4/fpm/pool.d/”.
  • For php8.0 it is “/etc/php/8.0/fpm/pool.d/”.
See also  How To Install WordPress Manually Using cPanel File Manager

Open php.ini file and search for “php_admin_value[open_basedir] =” and add your FastCGI cache path in following format.

php_admin_value[open_basedir] = “/var/cache/nginx/:/var/www/:”


If you cannot find the “php_admin_value[open_basedir] =” in your default php.ini file your custom configuration are in “pool.d” directory. Go to the PHP installation /fpm/pool.d/. In my situation that directory path is “/etc/php/8.0/fpm/pool.d/”.

Open the www.conf and search for “php_admin_value[open_basedir] =“. Then add the FastCGI custom cache path in the following format.




php_admin_value[open_basedir] = "/var/cache/nginx/:/var/www/:/tmp/:/var/run/nginx-cache/"

PHP Custom Cache path
Set custom cache path
  • Save the file and exit.
  • Restart the PHP.


Debug Nginx Helper.

Once you configured everything it is better to change the Nginx Helper plugin Log level to “Error” to identify any error or warning.

  • Go to WordPress “Settings> Nginx Helper”.
  • Under logging, option set the “Log level” as “Error“.

Nginx Helper Debug

  • Finally, save the changes.


You can check Nginx helper work in the custom FastCGI cache path as expected by purging the cache. In “Nginx helper” settings Click on the “Purge Entire Cache” button and check the log. Now it is not showing any error.

If the Nginx helper plugin doesn’t purge the cache, enable WordPress debugging and check whether the plugin experience any trouble while purging the cache.


error: Content is protected !!