Linux 软件免费装

Multi-Varnish HTTP Purge

开发者 Nelson_fss
更新时间 2014年1月17日 01:30
PHP版本: 3.4 及以上
WordPress版本: 3.8
版权: Apache License, Version 2.0
版权网址: 版权信息

标签

cache varnish purge mutli

下载

详情介绍:

Multi-Varnish HTTP Purge sends a PURGE request to the URL of a page or post on multiple Varnish instances every time it it modified. This occurs when editing, publishing, commenting or deleting an item, and when changing themes. Varnish is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. This plugin does not install Varnish for you. It's expected you already did that. Not all pages are purged every time, depending on your Varnish configuration. When a post, page, or custom post type is edited, or a new comment is added, only the following pages will purge: In addition, your entire cache will be purged on the following actions: The future ... I plan on keeping this fork current with any upgrades made to the main Varnish HTTP Purge plugin

安装:

No WordPress configuration needed. Requirements

常见问题:

What version of Varnish is supported?

This was built and tested on Varnish 3.x, however it is reported to work on 2.x. It is only supported on v3 at this time.

Why doesn't every page flush when I make a new post?

The only pages that should purge are the post's page, the front page, categories, and tags. The reason why is a little philosophical. When building out this plugin, there were a couple pathways on how best to handle purging caches and they boiled down to two: Decisions (the plugin purges what it purges when it purges) and Options (you decide what to purge, when and why). It's entirely possible to make this plugin purge everything, every time a 'trigger' happens, have it purge some things, or have it be so you can pick that purges. In the interests of design, we decided that the KISS principle was key. Since you can configure your Varnish to always purge all pages recursively (i.e. purging http://example.com/ would purge all pages below it), if that's a requirement, you can set it yourself. There are also other Varnish plugins that allow for more granular control (including W3 Total Cache), however this plugin will not be gaining a whole bunch of options to handle that.

Why doesn't my cache purge when I edit my theme?

Because the plugin only purges your content when you edit it. That means if you edit a page/post, or someone leaves a comment, it'll change. Otherwise, you have to purge the whole cache. The plugin will do this for you if you change your theme, but not when you edit your theme. That said, if you use Jetpack's CSS editor, it will purge the whole cache on save.

How do I manually purge the whole cache?

Click the 'Purge Varnish Cache' button on the "Right Now" Dashboard (see the screenshot if you can't find it).

Why is nothing caching when I use PageSpeed?

Because PageSpeed likes to put in Caching headers to say not to cache. To fix this, you need to put this in your .htaccess section for PageSpeed: ModPagespeedModifyCachingHeaders off If you're using nginx, it's pagespeed ModifyCachingHeaders off;

Can I use this with a proxy service like CloudFlare?

Yes, but you'll need to make some additonal changes (see "Why aren't my changes showing when I use CloudFlare or another proxy?" below). If you use the Jetpack CSS editor, however, your changes will show up.

Why aren't my changes showing when I use CloudFlare or another proxy?

When you use CloudFlare or any other similar servive, you've got a proxy in front of the Varnish proxy. In general this isn't a bad thing. The problem arises when the DNS shenanigans send the purge request to your domainname. When you've got an additional proxy like CloudFlare, you don't want the request to go to the proxy, you want it to go to Varnish server. To fix this, add the following to your wp-config.php file: define('VHP_VARNISH_IP','123.45.67.89'); Replace "123.45.67.89" with the IP of your Varnish Server (not CloudFlare, Varnish). DO NOT put in http in this define. You can also set the option vhp_varnish_ip in the database. This will NOT take precedence over the define, it's just there to let hosts who are using something like wp-cli do this for you in an automated fashion: wp option add vhp_varnish_ip 123.45.67.89 and wp option update vhp_varnish_ip 123.45.67.890

How do I purge Multiple Varnish instances?

add the following to your wp-config.php file: define('VHP_VARNISH_IP','123.45.67.89,266.600.33.1'); Replace "123.45.67.89" and "266.600.33.1" with the IP addresses of your Varnish Servers (not CloudFlare, Varnish). DO NOT put in http in this define, you can list as many Varnish Servers as you have in this way. you cannot use wp option add or wp option update to set more than one vhp_varnish_ip

How do I find my Varnish IP?

Your Varnish IP must be one of the IPs that Varnish is listening on. If you use multiple IPs, or if you've customized your ACLs, you'll need to pick on that doesn't conflict with your other settings. For example, if you have Varnish listening on a public and private IP, you'll want to pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. "listen on every interface you can") you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1). If your webhost set up Varnish for you, you may need to ask them for the specifics if they don't have it documented. I've listed the ones I know about here, however you should still check with them if you're not sure.

  • DreamHost - If you're using DreamPress, go into the Panel and click on the DNS settings for the domain. The entry for resolve-to.domain is your varnish server: `resolve-to.www A 208.97.157.172`

Why don't my gzip'd pages flush?

Make sure your Varnish VCL is configured correctly to purge all the right pages. This is normally an issue with Varnish 2, which is not supported.

Why isn't the whole cache purge working?

The plugin sends a PURGE command of /.* and X-Purge-Method in the header with a value of regex. If your Varnish server doesn't doesn't understand the wildcard, you can configure it to check for the header.

How do I configure my VCL?

This is a beyond this plugin question in a way, since I don't offer any Varnish Config help. I will say this, you absolutely must have PURGE set up in your VCL. This is still supported in Varnish v3, though may not be set up by default. Also, here are some links to other people who use this plugin and have made public their VCLs:

All of these VCLs work with this plugin.