tillkruss / nginx-fastcgi-cache Goto Github PK
View Code? Open in Web Editor NEWA WordPress plugin that purges Nginx cache zones.
A WordPress plugin that purges Nginx cache zones.
=== Nginx Cache === Contributors: tillkruess Donate link: https://github.com/sponsors/tillkruss Tags: nginx, nginx cache, cache, caching, purge, purge cache, flush, flush cache, server, performance, optimize, speed, load, fastcgi, fastcgi purge, proxy, proxy purge, reverse proxy Requires at least: 3.1 Tested up to: 5.6 Stable tag: 1.0.5 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html Purge the Nginx cache (FastCGI, Proxy, uWSGI) automatically when content changes or manually within WordPress. == Description == Purge the [Nginx](http://nginx.org) cache (FastCGI, Proxy, uWSGI) automatically when content changes or manually within WordPress. Requirements: * The [Filesystem API](http://codex.wordpress.org/Filesystem_API) needs to function without asking for credentials. * Nginx and PHP need to run under the same user, or PHP's user needs write access to Nginx's cache path. == Installation == For detailed installation instructions, please read the [standard installation procedure for WordPress plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins). 1. Install and activate plugin. 2. Enter "Cache Zone Path" under _Tools -> Nginx_. 3. Done. == Screenshots == 1. Plugin settings page. == Changelog == = 1.0.5 = * Added `nginx_cache_zone_purged` action = 1.0.4 = * Improved translatable strings * Fixed auto-purge bug * Fixed bug when validating directory = 1.0.3 = * Create cache directory if it doesn't exists * Re-create cache directory after cache purge * Allow post types to be excluded from triggering a cache purge = 1.0.2 = * Fixed 4.6 issue with file-system credentials = 1.0.1 = * Improved testing of file-system credentials = 1.0 = * Initial release
I'm seeing this error PHP Warning: Invalid argument supplied for foreach() in //plugins/Nginx-FastCGI-Cache/nginx-cache.php on line 198
And getting a 502 bad gateway error along with upstream sent too big header while reading response
This is my conf for fastcgi which I thought was related
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_cache_valid 60m;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
Any suggestions greatly appreciated.
Getting this error Filesystem API could not be initialized.
however i can upload plugins, update core, theme etc without having to supply login credentials so i dont think thats the cause.
I have the path specified as /var/cache/nginx and both have access by www-data user
When using wp-cron, events does not always trigger a cache purge i.e save_post. I got an error message saying request_filesystem_credentials is not defined in nginx-cache.php.
Is there any way for me to edit the plugin files such that I can add the purge option to the wordpress admin bar node for site editors (or people with a specific role) as well. At present only admins are able to access it if I'm not wrong.
@tillkruss Thanks for this great plugin.
More of a Feature request than an issue.
Do you have plans to make this plugin more multiple network friendly? Mainly moving the setup to the Network admin (Setting would be a good place) instead of individual sites (tools)?
Again, Thanks for the great plugin
Hi,
I'm trying to use nginx_cache_purge_actions
filter to register additional actions that should flush Nginx cache, but I noticed that this filter is applied right when plugin is loaded, so there's no way how to use this filter from (child) theme.
I understand this filter should be applied early, so one can register actions that are invoked early, but I would say running this filter in after_setup_theme hook should be early enough and would allow to use the filter from within themes.
If you're fine with my suggestion, I can make a pull request.
I tried adding add_option('nginx_cache_path', '/run/nginx-cache');
in several places, but could not add that option. Also setting 'nginx_auto_purge'
to '1'
automatically would be cool.
I'd really like to automate this and have little to no knowledge of PHP. Any help will be appreciated!
The plugin works super perfectly, so first thank you for making it! I use WP-PostViews plugin to count post views and it can use Ajax to count views on cached pages, however it uses Ajax only if the WP_CACHE is defined. In short, if it acknowledges that you're "using" a caching plugin, it uses Ajax to count the views. You can see another user noticed this: https://wordpress.org/support/topic/server-side-cache-not-working/
There may be other plugins that check for WP_CACHE, do you think it would be a good addition to somehow set WP_CACHE to true when the plugin is loaded?
Hi there,
I'm getting the following error:
Cache could not be purged. Filesystem API could not be initialized.
Nothing is appearing in the nginx error log. Any idea what's happening/how to debug?
Thanks
"Automatically flush the cache when content changes" checkbox isn't working.
I installed, activated, and set 'Cache Zone Path' plugin setting. Opened a given page in chrome incognito, then updated such page in wp-admin, then reloaded such page in chrome incognito. A MISS ocurred.
So the plugin is emptying the cache, just regardless of that setting.
Home URL: ***
Site URL: ***
WC Version: 3.2.6
Log Directory Writable: ✔
WP Version: 4.9.1
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: es_MX
### Server Environment ###
Server Info: nginx/1.13.3
PHP Version: 7.1.13-1+ubuntu16.04.1+deb.sury.org+1
PHP Post Max Size: 8 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
cURL Version: 7.47.0
OpenSSL/1.0.2g
...
Whenever I do anything in my site, like add a post I get redirected to a whitescreen asking for FTP credentials.
This only happens in 4.6, possibly related to
https://core.trac.wordpress.org/changeset/38138 or https://core.trac.wordpress.org/changeset/38167
Error log output:
2016/08/31 17:41:18 [error] 21551#21551: *174 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function submit_button() in /home/user/mysite.com/public/htdocs/wp/wp-admin/includes/file.php:1263
Stack trace:
#0 /home/user/mysite.com/public/htdocs/wp-content/plugins/nginx-cache/nginx-cache.php(258): request_filesystem_credentials('', 'ftpext', false, '/home/user/mysi...', Array, true)
#1 /home/user/mysite.com/public/htdocs/wp-content/plugins/nginx-cache/nginx-cache.php(169): NginxCache->initialize_filesystem()
#2 /home/user/mysite.com/public/htdocs/wp-content/plugins/nginx-cache/nginx-cache.php(232): NginxCache->is_valid_path()
#3 /home/user/mysite.com/public/htdocs/wp-content/plugins/nginx-cache/nginx-cache.php(221): NginxCache->purge_zone()
#4 /home/user/mysite.com/public/htdocs/wp/wp-includes/plugin.php(524): NginxCache->purge_zone_once(409546)
#5 /home/user/mysite.com/public/htdocs/wp/wp-includes/post.php(5594): do_action('clean_post_cach...', 409546, Object(WP_Po" while reading response header from upstream, client: 86.165.9.62, server: mysite.com, request: "GET /?file=0&did=408478&vp_edd_act=download&expire=MTQ3Mjc0Nzg2NA%3D%3D HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "mysite.com"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.