Linux 软件免费装
Banner图

Nginx Cache Purge Preload

开发者 psauxit
更新时间 2026年6月8日 13:26
捐献地址: 去捐款
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPLv2 or later
版权网址: 版权信息

标签

cache performance purge preload nginx

下载

2.0.3 2.0.5 2.0.2 2.0.1 2.0.7 2.0.6 2.0.4 2.0.8 2.1.2 2.1.6 2.1.7 2.0.9 2.1.0 2.1.1 2.1.3 2.1.4 2.1.5

详情介绍:

NPP lets WordPress users manage Nginx Cache Purge and Preload (FastCGI, Proxy, SCGI, UWSGI) operations directly from the WordPress admin dashboard — actively warming the cache via site crawl, so your Nginx cache is always preloaded and ready. NPP is the only Nginx cache plugin that doesn’t just clear the table — it sets the whole banquet. No other Nginx cache plugin comes close to its feature list, purge architecture, preload intelligence on WordPress.

安装:

Manual Installation
  1. Upload the "fastcgi-cache-purge-and-preload-nginx" folder to the "/wp-content/plugins/" directory.
  2. Activate the plugin through the "Plugins" menu in the WordPress admin dashboard.
  3. Configure plugin settings under "Settings" -> "Nginx Cache Purge Preload" in the WordPress admin dashboard.
  4. Access "Nginx Cache Purge Preload" operations from the WordPress admin bar (frontend & backend), the Admin Dashboard, and the Plugin Settings page.
Automatic Installation
  1. Log in to your WordPress admin panel, navigate to the "Plugins" menu and click "Add New".
  2. In the search field type “Nginx Cache Purge Preload” and click "Search Plugins". From the search results, pick "Nginx Cache Purge Preload" and click "Install Now". Wordpress will ask you to confirm to complete the installation.

屏幕截图:

  • Purge Options (Auto Purge - Cloudflare - Redis)
  • Purge Scope (Related Page Purge)
  • Preload Options (Auto Preload, Preload Mobile, Mobile User Agent)
  • Preload Options (Preload Watchdog, Proxy, URL Normalization, CPU Limit)
  • Preload Options (Exclude Endpoints, Exclude Extensions, Limit Rate, Wait Time)
  • Schedule Options (WP-Cron, REST API)
  • Advanced Options (Cache Key Regex)
  • Advanced Options (HTTP Purge, RG Purge)
  • Mail Options - Logging Options
  • Status Tab (Clear Plugin Cache, Clear URL Index)
  • Status Tab (Live Preload Progress, Nginx FUSE Status)
  • Status Tab (System Checks, Cache Status)
  • Advanced Tab
  • Help Tab
  • Dashboard Widget
  • Setup Page
  • Mail Template

升级注意事项:

2.1.7 Cache coverage release. Read Changelog for best results. 2.1.6 Performance/functionality fixes included. Please Reset Default the Cache Key Regex. Upgrade immediately. 2.1.5 Security and data-safety fixes included. Upgrade immediately. 2.1.4 Introduces Nginx Cache Analyzer, safexec hardened execution, Purge Scope for related pages, and a Setup Wizard. Recommended upgrade for all users. 2.1.3 Security patch for CVE-2025-6213. Upgrade immediately. 2.0.1 Important fixes for function/class/define/namespace/option names. Internationalization and security improvements.

其他记录:

For more information, visit the plugin development page: Nginx Cache Purge Preload

常见问题:

Does this plugin require Nginx?

Yes. NPP is designed exclusively for Nginx web servers running on Linux. It does not work on Apache, shared hosting, or environments where shell_exec and exec are disabled.

Does it require the ngx_cache_purge Nginx module?

No. The ngx_cache_purge module is optional. When available, NPP uses it as the fastest purge path (HTTP Purge). If it is not present, NPP automatically falls back to a URL index lookup and then a full filesystem scan. Nothing breaks either way.

What server dependencies are required?

Mostly basic, built-in shell tools are required. wget is required for cache preloading. For hardened shell execution, safexec is highly recommended — see the Help tab for installation instructions. For large cache-heavy websites, especially when Nginx cache paths are located on FUSE-based mounts (such as bindfs to solve permission issues), ripgrep (rg) is strongly recommended for significantly faster cache purge performance.

Why is the plugin not working on my environment?

The most common reasons are: shell_exec and exec is disabled, open_basedir restrictions prevent required filesystem access, the PHP-FPM user lacks write permission to the Nginx cache directory, or automatic Nginx detection fails (for example, nginx.conf cannot be located). See the Help tab for a full environment checklist and solutions.

I am getting permission errors. What should I do?

This is the most common issue in environments where the WEBSERVER-USER (nginx/www-data) and PHP-FPM-USER are different. NPP provides a one-liner bash script to automate the fix using bindfs on monolithic servers. For containerized environments, users can review the full configuration setup via NPP Containerized See the Help tab → Permission Issues section or the GitHub repository for details.

Does it work with Cloudflare?

Yes. NPP has built-in Cloudflare APO Sync that mirrors every purge to Cloudflare’s edge cache automatically. Requires the official Cloudflare WordPress plugin. Enable it under Settings.

Does it work with Redis Object Cache?

Yes. NPP supports Redis Object Cache Sync, which keeps Redis and the Nginx cache aligned during purge and preload operations. When enabled, NPP flushes the Redis object cache at the correct point in the Nginx Purge + Preload chain to ensure fresh content is used when rebuilding cache. Enable it under Settings.

Is it compatible with WooCommerce?

Yes. NPP includes built-in WooCommerce Auto-Purge for stock changes and order events, and supports purging the Shop page as a related URL when a product is updated.

Can I use it alongside other caching plugins?

Yes, but disable page caching in other plugins to avoid conflicts. You can keep their frontend optimization features (minification, lazy loading, CDN) active. See the Help tab for details.

Where can I find the allowed Nginx cache paths?

NPP restricts cache paths by default to prevent accidental deletion of system files. Allowed roots are /dev/shm/, /tmp/, /var/, and /cache/. The path must be at least one level deep (e.g. /var/cache/nginx). These restrictions can be completely disabled using the Bypass Path Restriction feature, which removes all path safety guardrails and allows any directory to be used as the Nginx cache path. Full details in the Help tab.

Does NPP support WP-CLI?

Yes. NPP includes full WP-CLI integration. You can purge, preload, check status, view logs, update settings, flush transients, and manage scheduled events directly from the terminal — no admin dashboard access required. Run wp help npp and wp help npp <subcommand> to see all available commands.

What Nginx cache types are supported?

NPP supports FastCGI, Proxy, SCGI, and UWSGI cache methods. The plugin automatically applies the appropriate purge strategy (HTTP Purge, INDEX Purge, or RG Purge).

What is HTTP Purge and how do I set it up?

HTTP Purge is an optional fast‑path that uses Nginx's ngx_cache_purge module to delete cache entries via a simple HTTP request. It is the fastest possible single‑URL purge method because it avoids any filesystem scan.

What is RG Purge and should I enable it?

RG Purge is a lightning‑fast alternative to the traditional PHP filesystem scan. It uses ripgrep (rg) — line-oriented search tool written in Rust — to locate nginx cache files in a fraction of the time. In a standard Nginx cache with thousands of URLs, the built‑in PHP recursive iterator can take 10–60 seconds to find all cache entries for a single page purge. RG Purge reduces this to 1–2 seconds regardless of cache size by using parallel directory traversal and memory‑mapped I/O. When to enable: large sites over 10.000 URL.

What is Index Purge and how does it speed up single‑URL purges?

During every cache preload, NPP quietly builds a persistent URL‑to‑filepath index. When you later purge a specific page (manually, or via auto‑purge), the plugin first checks this index. If the URL is found, NPP instantly knows the exact cache file location and deletes it immediately — with zero disk scanning. This is the second‑fastest purge path (FP2) and works even on sites with hundreds of thousands of cached files. The index is automatically updated after each purge and can be cleared manually from the Status tab if your cache structure changes.

What is safexec and why is it used?

safexec is a small, privilege‑dropping wrapper (written in C) created specifically for NPP. It is used to safely execute system commands like wget, and rg while enforcing strict security controls. What it does:

  • Drops privileges to a low‑privilege user (nobody) before running the shell command.
  • Scrubs the environment to prevent information leaks.
  • Optionally normalizes percent‑encoded characters in URLs during cache preloading — solving a common cause of duplicate cache entries (e.g., %2F vs /). Without safexec, the plugin runs commands with the same permissions as the PHP process. safexec adds an extra layer of isolation and is especially valuable:
  • Where you want to limit the impact of shell operations (injections).
  • In FUSE environments where the PHP user lacks access to the underlying cache directory — safexec can temporarily assume the Nginx user's identity to read directly from the real path. URL Normalization modes: In Preload Settings you can choose how safexec handles percent‑encoded URLs:
  • OFF – No normalization (default).
  • UPPER – Convert all percent‑encoded sequences to uppercase (e.g., %2f → %2F).
  • LOWER – Convert to lowercase.
  • PRESERVE – Keep original casing but still normalize unreserved characters. This is crucial if your Nginx $request_uri cache key treats different entries, which can lead to cache fragmentation. Choose the mode that matches your Nginx configuration.
safexec is entirely optional. NPP works without it, but for production sites, especially those with FUSE mounts or strict security requirements, it is highly recommended.

Does NPP cache pages that contain a question mark (?), like filters or UTM tags?

Yes. NPP's preload engine no blindly ignores all query‑string URLs. It uses a smart list of unsafe parameters (cart, checkout, admin, preview, etc.) and allows everything else — sorting options, product filters, language switches, UTM marketing tags — to be preloaded and served from cache. This dramatically increases cache coverage for WooCommerce stores and busy content sites.

Can the cache be automatically preloaded after a purge?

Yes. When Auto Purge is enabled and Auto Preload is switched on (globally or per‑page), NPP will immediately begin preloading the affected pages after a purge — no manual steps required. This keeps the cache warm even after content updates, stock changes, or theme/plugin upgrades.

Does NPP preload RSS and Atom Feeds?

Yes. NPP includes a "Preload Feeds" option that warms your main RSS2, Atom, per‑post comment feeds, and taxonomy‑specific feeds (categories, tags, custom taxonomies). This ensures feed readers, RSS‑to‑email services, and search engine crawlers always receive a fast, cached response — without waking up PHP on every refresh.

How is NPP's purge system different from other Nginx cache plugins?

Most Nginx cache plugins rely on a single purge method — usually a slow, recursive PHP scan of every file in the cache directory, or they require a special Nginx module. NPP uses a layered fast‑path chain that automatically picks the fastest available method for every single‑URL purge, without you needing to configure anything:

  1. FP1 – HTTP Purge – If the ngx_cache_purge module is present, NPP instructs Nginx to delete the cache entry via a simple HTTP request. Near‑instant.
  2. FP2 – Index Purge – If the URL is already indexed from a previous preload, NPP finds the cache file path in memory — zero disk scanning.
  3. FP3 – RG Purge – If ripgrep is installed, a single, highly optimized system command locates all matching cache files in 1–2 seconds, even on directories with 50,000+ files.
  4. FP4 – PHP recursive scan – The traditional method; used only as a silent fallback when nothing faster is available.
This design means:
  • No single point of failure — if one method isn’t available, the next one takes over automatically.
  • Your purges are always as fast as your server environment allows, without changing any settings.
  • You can improve purge speed later simply by installing ripgrep or enabling the Nginx module — the plugin adapts instantly. No other Nginx cache plugin offers this kind of resilient, self‑optimizing purge stack. It is one of the key reasons NPP stays fast and safe even on massive WooCommerce sites, and high‑traffic news platforms.

更新日志:

2.1.7 (2026-06-08) 2.1.7 is the cache coverage release. The core motivation: cache every URL that is safe to cache — not blindly deny everything with a query string. This release fixes that at both layers: the preload engine and the Nginx skip-cache rules it complements, turning previously invisible URLs into cache HITs. WP-CLI support lands as the headline milestone, making full cache management available from the terminal for the first time. Before upgrading, three things to be aware of:
  1. Verify your Nginx skip-cache rules match the new preload regex approach and use "Reset Default" on the "Exclude Endpoints" setting.
  2. Use "Reset Default" on "Cache Key Regex" to activate expanded cache key format support.
  3. Confirm ripgrep >= 14.0.0 and that both "shell_exec" and "exec" are enabled in your PHP configuration.
  4. WP-CLI Support (Milestone): Introduced full CLI integration. You can now manage cache purges, preloading, status reporting, logging, settings updates, flush, and schedules directly from the terminal.
  5. NEW: "Preload Feeds" – Users can now fully manage feed caching at both site‑wide and per‑URL levels. Feeds (main RSS/Atom, per‑post comment feeds, and taxonomy RSS feeds) are controlled via the "Preload Feeds" option.
  6. NEW: Advanced Tab "Preload All MISS" – A lighter alternative to "Preload All". When your cache is already mostly warm (>50%), it skips the expensive full‑purge step (Preload All always do full purge) and only preloads the cache that are currently missing. Ideal for high cache coverage sites where "Preload All" would be wasteful.
  7. NEW: Walkie – a tiny animated character that lives in the plugin header, walks along the ribbons, and cracks cache‑related jokes. Purely for fun during long preloads to keep users company – not a real AI assistant. (He fully believes he’s a real AI, though.)
  8. Fixed: A false-negative in Nginx detection on Nginx+Apache proxy stacks, which rendered the plugin completely non-functional even when Nginx was active as the front proxy.
  9. Fixed: Unprotected (function_exists) shell_exec and exec calls across the REST API, WP Cron, Dashboard Widget, and all other relevant execution paths.
  10. Fixed: Missing check for getenv / putenv for URL Normalization (safexec).
  11. Fixed: An edgecase where users are locked out by the transient cache because the Status tab and "Clear Plugin Cache" button are inaccessible when plugin functionality is disabled.
  12. Fixed: Broken Nginx cache keys listing in the Status tab.
  13. Fixed: Prevent settings/option updates (REST/WP-CLI/UI) during active purge/preload operations to ensure process state consistency.
  14. Fixed: Separated safexec and native kill paths to prevent redundant process-killing attempts in premature process detection logic.
  15. Fixed: Recurring cron events (nppp_index_updater_event, npp_cache_preload_event) silently dying after their first run.
  16. Fixed: nppp_index_updater_event self-healing — event now auto-reschedules on next admin load if wiped externally by WP-CLI, a cron manager plugin, or a database import.
  17. Fixed: URL→Filepath index is now automatically flushed on WordPress permalink structure changes.
  18. Fixed: URL→Filepath index is now automatically flushed when Nginx Cache Path changes.
  19. Fixed: Default Cache key regex no longer embeds non-GET/HEAD HTTP methods (POST, PUT, DELETE, PATCH, OPTIONS) into the host segment when parsing $scheme$request_method$host$request_uri keys caused silent purge failures.
  20. Resolved: Multiple PHP 8+ deprecation warnings regarding passing null or false values to string and array functions (trim(), end()).
  21. Performance (Critical Fix): Advanced Tab single Purge action no longer freezes the browser on large caches (30,000+ rows) when Purge Scope sub-triggers enabled. Replaced O(N) full‑table scans with an O(1) URL→row index cache, batched DataTable redraws.
  22. Performance: Added --no-mmap flag to ripgrep cache scans for faster I/O on large directories of small binary cache files.
  23. Performance: Restructured the Related Preload engine into a single process, collapsing dozens of related URL preload into a maximum of 2 background operations (Desktop, Mobile).
  24. Improved (Requires Nginx Config Update): Overhauled the preload engine reject regex from a blanket query-string exclusion to a selective named-parameter denylist. Sites upgrading from prior versions will see a significant increase in preload scope and cache coverage. Verify your Nginx skip-cache rules are also compatible with new changes. To activate the new preload default rules, use the "Reset Default" button for "Exclude Endpoints" in plugin settings. Preload behavior changes significantly.
  25. Improved: Nginx detection and Setup (Assume Nginx Mode) process. Nginx detection and setup page redirection is now prioritized before all other environment checks with clean instructions.
  26. Improved: UI/UX on Setup Page.
  27. Improved: Compatibility on aaPanel. Fully tested and functional (Single and Multi WebServer arches). See github aaPanel/issues/270 and aaPanel/issues/276 for ongoing issues reported. (Thanks to @neikoloves)
  28. Improved: Status tab diagnostic reporting to explicitly flag outdated ripgrep binaries.
  29. Improved: Degrade into the PHP recursive scanner fallback if an outdated version of ripgrep is detected on FP3 Purge.
  30. Extended: Purge Scope now purges Author archives when a post is saved or updated.
  31. Extended: Purge Scope now purges Date-based archives (year, month, day) when a post is saved or updated.
  32. Extended: Purge Scope now purges RSS feeds on relevant purge events: main site feed on post publish/update, per-post comments feed when comments are open or present, and per-taxonomy RSS feeds alongside their archive pages.
  33. Extended: Purge Scope now purges paginated comment URLs for posts when WordPress comment pagination is enabled, including both pretty-permalink and query-string comment page variants.
  34. Extended: Purge Scope taxonomy archive purging now covers all public registered taxonomies generically (custom taxonomies, WooCommerce product attribute archives).
  35. Extended: Default Cache Key regex is now also support "$scheme://$host$request_uri | $host$request_uri | $host$uri$is_args$args". To activate the new cache key regex rules, use the "Reset Default" button for "Cache Key Regex" in plugin settings.
  36. Changed: Hard dependency extended to require both shell_exec and exec (rg). REGRESSION!
  37. Added: Proper open_basedir compatibility detection and admin warning for missing required paths.
  38. Added: Detection for Vary: Accept-Encoding may cause double‑cache issue (dismissable completely).
  39. Added: Strict minimum version requirement for ripgrep (>= 14.0.0)
  40. Added: Cache Key Regex validation checks now trigger global warnings when custom or default regex fail.
  41. Added: "Test Regex" button to live-verify the cache key regex against a real cache file.
  42. Removed: False-positive and redundant warning messages on the Status and Advanced tab.
  43. Removed: /feed/ and comment-page- from the preload defaults; feeds and comment pages are now preloaded by default.
  44. Balanced: Lowered TTLs of several internal plugin transients to make the UI reflect changes more quickly. Reduces the need for manual “Clear Plugin Cache” after configuration changes.
  45. Developer: nppp_purged_all action hook — fired after every successful full Nginx cache purge, enabling third-party plugins to trigger their own cache flush in sync.
  46. Updated: DataTables assets bump to version 2.3.8 for improved Advanced Tab rendering and stability.
  47. Updated: Tested up to WordPress 7.0
  48. Tested: Tested with Nginx (1.31.1), FUSE (3.18.2), bindfs (1.18.4), safexec (1.9.6), ripgrep (15.1.0), wget (1.25.0) and aaPanel (8.0.3).
2.1.6 (2026-04-27) 2.1.5 (2026-03-23) 2.1.4 (2025-10-04) 2.1.3 (2025-07-22) 2.1.2 (2025-06-23) 2.1.1 (2025-03-17) 2.1.0 (2025-02-23) Major Release: 46 files changed, 5,170 additions, 1,410 deletions. Now fully supports internationalization, enabling complete translation for a global user base. 2.0.9 (2024-11-30) Milestone: Add support for preloading cache separately for Mobile devices Milestone: Resolved the long-standing issue prior to version 2.0.5, where users encountered a "Not a valid JSON response" error. 2.0.8 (2024-11-24) 2.0.7 (2024-11-22) 2.0.6 (2024-11-21) 2.0.5 (2024-11-17) Now more powerful with custom fastcgi_cache_key support. Here's the short changelog for version 2.0.5, with contributors proudly mentioned. 2.0.4 (2024-10-10) This is a massive update: 39 changed files, 3,392 additions, and 1,063 deletions. Here the short changelog for version 2.0.4 2.0.3 (2024-08-09) 2.0.2 (2024-06-30) 2.0.1 (2024-05-24) For the complete changelog, see changelog.txt.