Varnish WordPress - A cache plugin for WordPress

This is a place holder page for the next 3-4 weeks until our new website is online.

This is a plugin for wordpress to intergrate the varnish cache for high performance websites.

This plugin will purge the cache on,

*  Post changes (new, edit, trash, delete).
*  Page changes (add, edit, remove)
*  Comment changes (add, edit, approve,  unapprove,  spam,  trash,  delete)
*  Theme changes

Installation

To install the WordPress plugin.

1. Get the latest version from https://www.admingeekz.com/files/varnish-wordpress.zip
2. Copy the varnish-wordpress folder to wp-content/plugins/
3. Login to wp-admin
4. Go to Plugins->Installed Plugins on the left menu
5. Under "Varnish WordPress" click "Activate"
6. You should now see the varnish menu under "Settings"

To install the varnish VCL. 

1. Copy the file "default.vcl" provided with this plugin  to your varnish installation path (/etc/varnish/default.vcl on most systems)
2. Configure the backend in the default.vcl to point to the ip and port your webserver(s) are running on
3. Restart varnish

 To configure the WordPress plugin 

1. In the varnish backends box input the backends we need to access to purge the cache. (Format:  ip:port)
2. Check the enabled box
3. Click Save

Frequently Asked Questions

Q:Can it support SSL

A:Varnish does not support SSL however you can use another webserver to terminate the SSL and forward HTTP traffic to varnish, such as nginx and use the hash_data to include the X-Forwarded-Port. For example,

In vcl_recv add

#Force the forwarded port to 80 if not SSL
if (req.http.X-Forwarded-Port != "443" ) {
   set req.http.X-Forwarded-Port = "80";
} 

In vcl_hash add
hash_data(req.http.X-Forwarded-Port);
An example SSL config is at https://www.admingeekz.com/varnish-wordpress/default.ssl.vcl

Q:I see the IP of the varnish server instead of the end users IP

A:If you are using Apache you can use our mod_rpaf fork to convert these IPs.
If you are using nginx you can use the HttpRealipModule , example

set_real_ip_from   127.0.0.1;
real_ip_header     X-Real-IP;