Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Varnish vs Nginx?
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.

Varnish vs Nginx?

dnwkdnwk Member

Varnish vs Nginx?

Both could work as a http cached proxy. Which one is better in terms of performance? Or more easy to manage(I mean by manage multiple instance in multiple server.)?

Comments

  • awsonawson Member

    well, varnish is more advanced in terms of caching, but nginx is more suitable as a web server

    use both

  • dnwkdnwk Member

    Is there some kind of system to sync configure/manage instance of either varnish or nginx across different servers?

  • jbilohjbiloh Administrator, Veteran

    Varnish is incredibly powerful. Really cool stuff.

    So long as you aren't using Apache you've got my approval!

  • XSXXSX Member, Host Rep

    varnish is cache server, nginx is proxy server.

  • MunMun Member

    technically nginx is a proxy caching server, and so is varnish.

    Zen is amazing.

    Mun

  • walesmdwalesmd Member
    edited May 2013

    They are 2 completely different applications: you may as well ask "Word vs Powerpoint"?

    I prefer a stack like so, which includes the addition of HAproxy (dynamic content goes nginx, static to Varnish):

    HTTP: HAproxy --> (Varnish or nginx) --> App (PHP, Python, NodeJS, etc)

    Since Varnish doesn't support HTTPS you have a few options, for just a cart implementation I'd go with #1. If you serve the entire site over HTTPS obviously the others are better choices:

    1: HAproxy --> nginx --> App (PHP, Python, NodeJS, etc)
    2: HAproxy --> nginx --> Varnish --> nginx --> App
    3: HAproxy --> Pound --> Varnish --> nginx --> App

    This StackOverflow question and the linked to blog post is one of the best pros/cons overviews I've seen.

  • bdtechbdtech Member

    Nginx has all the power of varnish and more

  • jcalebjcaleb Member

    i like to learn varnish

  • EpidriveEpidrive Member
    edited May 2013

    Why not both, Varnish + Nginx?

  • nstormnstorm Member

    Really depends on what you host behind apache.
    But cache proxy are useful mostly for static content only. And both varnish & nginx here perform nearly the same.
    I think nginx are better documented and more widely used.

    PS: Check this benchmarks also http://www.garron.me/en/linux/apache-vs-nginx-php-fpm-varnish-apc-wordpress-performance.html

  • I use nginx in front of varnish, and varnish in front of apache!
    nginx cache css/js/image. Varnish use for fullpage cache.

  • MunMun Member

    @DarsyTay said:
    I use nginx in front of varnish, and varnish in front of apache!
    nginx cache css/js/image. Varnish use for fullpage cache.

    Then that is how you have set it up. You can cache any extension with Nginx.

  • dnwkdnwk Member

    @FrapHost said:
    Why not both, Varnish + Nginx?

    I need a server as a front end proxy/cache. So, there is no reason to use both. For backend server, it is out of scope of this question.

  • dnwkdnwk Member

    @DarsyTay said:
    I use nginx in front of varnish, and varnish in front of apache!
    nginx cache css/js/image. Varnish use for fullpage cache.

    Why you need nginx-> varnish->apache?

    I think varnish->apache or nginx->apache should be enough?

  • dnwkdnwk Member

    @nstorm said:
    Really depends on what you host behind apache.
    But cache proxy are useful mostly for static content only. And both varnish & nginx here perform nearly the same.
    I think nginx are better documented and more widely used.

    PS: Check this benchmarks also http://www.garron.me/en/linux/apache-vs-nginx-php-fpm-varnish-apc-wordpress-performance.html

    Yes. Good tutorials for Varnish is really difficult to find

  • @dnwk said:
    I think varnish->apache or nginx->apache should be enough?

    beginning, I use nginx -> apache, but it's slow to, then I set varnish between nginx and apache. If not searching, very fast, and get low load

  • SplitIceSplitIce Member, Host Rep
    edited May 2013

    nginx depends on more of an expert configuration than varnish
    nginx has alot more flexibility, but that can cost in performance if configured in correctly (e.g If is Evil).

    Personally I side with a correctly configured nginx, else if you aren't capable Varnish. Although if you dont have the traffic (1M+ PV) who cares.

  • nunonuno Member

    The main difference between nginx and varnish when caching are flexibility and purging.

    Varnish is more flexible when you have complex cache structure and/or need esi. Purging/Banning is another key advantage of varnish, You can have different ttls and regex ban, something not possible in nginx.

  • +1 for Nginx

Sign In or Register to comment.