Disclaimer: I'm not an expert on either Linux, Nginx, Varnish or anything related to servers but I've managed to get a Linode VPS up and running, serving two blogs with Wordpress on them to different domains. However;

The sites are basically just copies of other setups and nothing that I've done myself, so I wanted to try things out for myself. Tried Apache, tried Nginx with Wordpress and W3 Total Cache and APC. I love optimization, and was curious if running Nginx and Varnish together would yield better results than just Nginx? This is with a Wordpress site with APC and W3 Total Cache.

Or would just running Nginx as a reverse proxy with Varnish caching with Apache as the backend (as I understood it at least, might be wrong) overall the best solution?

Any input is greatly appreciated. Thanks!


Nginx can be configured to serve static content, serve PHP-generated content via HttpFcgiModule, and cache content via HttpProxyModule. You don't need Varnish or Apache. In your circumstances I would focus on understanding the configuration of one web server rather than two or three.

| improve this answer | |

Not at all.. here is what I do right now

nginx -> varnish -> apache

so on my proxy box is the

nginx -> varnish

and behind varnish I have a bunch of apache servers

The nginx before varnish also serves to terminate ssl since varnish cannot handle it. Our site runs on all ssl if you are logged in so we still want to cache pages.

| improve this answer | |
  • Thanks for the response, do you have a tutorial or guide on setting it up? I could do it on my own, but it would take forever, heh. Anyways, thanks for the response! – Sondrizzle Oct 19 '11 at 14:24
  • Hi mike, how did you work out the SSL termination on the nginx – Vic Mar 13 '13 at 4:54

Putting an nginx in front of varnish is also good if you want gzip compression, because that's also something varnish can't handle. Atleast version 2.1.5, haven't looked into 3.x yet.

| improve this answer | |
  • 1
    As of v3.0 Varnish has gzip support, including stitching together compressed ESI fragments. – rossnz Oct 25 '11 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.