New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Varnish and Wordpress
Does anyone have any good pointers on how to use varnish for wordpress.
I have seen all the official documentation and their samples, plus few other articles but nothing does the work properly as lot wp plugins are cookie sensitive.
Some kind of elaborate and well documented article would be much appreciated?
Thx
Comments
what plugins do you use that require cookies? A basic start is to remove/ignore cookies from every path but /wp-admin/
that was the first think i did but client has a dozen plugins and few do not work.
One i remember is called comment cookies .... that is basically a clever free anti spam filter. Basically it flags comments with cookies to flag spam bots
I just look for a complicated configuration file with lots of comments to go through and make sense.
https://www.digitalocean.com/community/articles/how-to-install-wordpress-nginx-php-and-varnish-on-ubuntu-12-04
https://www.digitalocean.com/community/articles/how-to-install-and-configure-varnish-with-apache-on-ubuntu-12-04--3
Thanks @sbmcosg but i need something more elaborate to be honest.
Something like:
http://crlog.info/2011/09/10/install-and-configure-varnish-3-0-1-cache-with-wordpress/
I use this plugin https://github.com/pkhamre/wp-varnish and combine wordpress.vcl with default.vcl
Thanks @isy44h112
PSA: Varnish + Nginx is a total waste of time and resources. Nginx alone will suffice.
If you have user-specific cookies that are being actually used by the wordpress plugins to serve specific pages, then varnish ISN'T going work that well. The best you could get then is for it to act as a reverse proxy for only static files.
If however, the cookies are just for tracking like google analytics (and happen to be passed along annoyingly), then the key part you need is "set req.http.Cookie = regsuball(req.http.Cookie, ..."
You'll need to pop open an inspector and try to figure out a few regular expressions to strip them all out. If anything cookie is left, then varnish has to let it pass and it'll hit the backend every time. The VCL you posted from crlog is pretty conservative on that front since it only strips out GA/comment cookies.
P.S. there's no monolithic VCL that'll do everything. Pick what performance items you're targeting. Is this a straight-up reverse proxy, or are you trying to accelerate wordpress?
Its for wordpress mainly and especially targeting mobile devices
In the end i used APC + Mod_PageSpeed + Memcached + W3 + Smush.It + .... and the performance improved anywhere from 300% to 400%.
On the hardware side i added SSD Cache to the VM and doubled the mem for the caching to work.
I give up on varnish at this stage.
Cheers.
How many visits/day are you talking about?
deactivate W3 and let varnish work alone in front.