This plugin provides some functions of controlling Nginx proxy server cache.
安全
- Making comment authors' information ajaxed to prevent the information from caching.
- Send no-cache header on password protected posts to prevent the posts from caching.
- When a scheduled post is published, it will delete the cache through Ajax.
Controlling cache
- Sending X-ACCEL-EXPIRES, you can specify the available period of the cache.
- When you save your post and someone post comments, the cache is deleted automatically.
- Add a menu on the admin bar to delete the cache.
Memo
- Gets comment poster's IP address by HTTP_X_FORWARDED_FOR header.
- Fixes the issue that the permanent link setting includes index.php.
- When the cache's expiration period is more than 86400 sec, change the value of wp_verify_nonce() same as the period.
WP-CLI Support
Flush all proxy caches.
wp nginx flush
Show list of all proxy caches.
wp nginx list --format=csv
wp nginx list --format=json
See help.
wp help nginx
语言
Contributor
- A plug-in installation screen is displayed on the WordPress admin panel.
- It installs it in
wp-content/plugins
.
- The plug-in is made effective.
Example of Nginx settings:
Allow X-ACCEL-EXPIRES for fastcgi.
location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $vhost_root/$fastcgi_script_name; fastcgi_pass_header "X-Accel-Redirect"; fastcgi_pass_header "X-Accel-Expires"; }
Setting cache directory for reverse proxy.
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=czone:4m max_size=50m inactive=120m;
- The default path is /var/cache/nginx.
- The default value of levels is 1:2.
- You can change the cache path at the admin panel.
Setting the key for the reverse cache proxy.
proxy_cache_key "$scheme://$host$request_uri"
- You can customize proxy_cache_key with
nginxchampuru_get_reverse_proxy_key
hook.