0

We use VPS with Debian, Nginx 1.24 + PHP-FPM 8.3 with active Fastcgi cache. Everything works ok, but if we want to purge cache from Wordpress, it removes only cache file, not folders. We use Nginx Helper in Wordpress . With previous (and unsupported) plugin Nginx Cache we dont have problem - remove cache with folders.

The plugin requires ngx_cache_purge module, but is not supported in the version 1.24, but purging the cache works.It is possible that version 1.24 already has a similar function integrated.

Has anyone encountered with this problem?

Vhost conf file:

fastcgi_cache_path /var/cache/nginx-cache/brainya levels=1:2 keys_zone=brainya:50m inactive=10m;

location ~ \.php$ {
          fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
        include snippets/fastcgi-php.conf;
        fastcgi_cache brainya;
        fastcgi_cache_valid 200 301 302 2h;
        fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
        fastcgi_cache_min_uses 1;
        fastcgi_cache_lock on;
        fastcgi_cache_bypass $no_cache;
        fastcgi_no_cache $no_cache;
        add_header X-FastCGI-Cache $upstream_cache_status;

Nginx Helper setting Folders

We tried Nginx version 1.22, change fastcgi setting, rights to folders and files

3
  • I can understand the desire to have these no longer exist when a purge happens, but are these folders causing you problems? Commented Feb 9, 2024 at 14:31
  • No, but after a few weeks there are thousands of folders... I can solve it with cron, which always deletes them, but I'm looking for a solution directly in WP. Commented Feb 9, 2024 at 16:14
  • So, once again, no problem, right? Like you aren’t noticing any performance issues? You’ve got cache levels set at 1:2, so at a maximum you’ll have 4,096 folders (16 root folders, and in each 256 sub folders). (This also assumes my math is correct this early in the morning.) I understand that before it was clearing these out, and isn’t now, but is there a reason you want them gone? They will keep coming back, and shouldn’t be hurting you in any way. I don’t have a fix for you, either, unfortunately, but I also think there might not be anything to fix really. Commented Feb 9, 2024 at 16:24

1 Answer 1

0

It sounds like you're encountering issues with the Nginx Helper plugin not purging FastCGI cache folders due to its dependency on the ngx_cache_purge module, which may not be fully supported in newer Nginx versions. This extra module dependency can sometimes lead to complications in cache management on WordPress.

Alternatively, the Nginx FastCGI Cache Purge & Preload (NPP) plugin offers a unique solution. Instead of relying on external Nginx modules, NPP leverages a server-side approach involving Linux tools like inotifywait and setfacl, facilitated through a pre-made bash script by plugin author. This method automates the granting of write permissions from the Nginx cache directory to the PHP-FPM-USER, ensuring efficient cache purging and preloading without external Nginx module dependencies.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.