Blake

Varnish works with Movable Type?

Vote 0 Votes

Does Varnish play nicely with Movable Type?

We have a 2 webserver setup that traffic is load balanced to and the app home is going to be on a NAS. Will it work to install Varnish on the webservers to cache static content from the NAS for the website? Have you ever heard of this being done before?

Thanks in advance,
Blake

Reported on Movable Type 4.2

3 Replies

| Add a Reply
  • No reason why it wouldn't, in any mode other than dynamic publishing. You'll just need to make sure that Varnish makes the content accessible at the same URL that you specified for the blog under publishing preferences and that MT is publishing the files to the NAS (these settings can be independent in MT).

  • I have MT running with Varnish (on a single machine, though, using nginx as web server), and it works incredibly well. That said, if you have a configuration that works without Varnish, it should work with Varnish - dynamic publishing, too.

    If the web server and Varnish run on the same machine, just make sure your normal web server runs on a different port than 80. Besides that: All you have to do (not talking about some Varnish VCL tuning to e.g. strip cookies for non-admin access etc. so you have as much cached as possible etc.) is to point Varnish to this or these backends, and you should be set.

    If you explicitly want to cache only static assets, you can configure it this way, and have everything else passed through. It still has reside on the defined backends, though, and can't be rerouted to another server. For this kind of setup, you may consider a Varnish -> nginx -> Apache setup, where nginx provides anything static, and fetches anything dynamic. That part probably is only necessary with high traffic / low caching dynamic pages, as nginx scales incredibly well.

    If you happen to use Varnish, MT and static publishing, I just programmed a plugin that purges Varnish's cache of modified entries, so you can stretch out caching times even further without ever having outdated content. Let me know if you want to have it (no, it's free, it's GPL, I just haven't made it public (yet?)).

    - Ben

  • Thanks for the info Ben! I actually did end up putting Varnish in front and got it working pretty well. We're in the middle of moving to WordPress so no need for the plugin. Thanks for the offer though and it sounds like a nice plugin to have if using MT. Also, I couldn't agree with you more about scaling nginx. nginx is such an awesome webserver with so much to give!

    -Blake

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012