Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am evaluating the benefits of adding nginx to our webfarm as a reverse-proxy for static content, and looking for feedback from anyone who has experience with this setup.

What are the pros/cons of this setup? I'm having difficulty finding examples / howtos / objective experiences.

  • Is it worth it?
  • How difficult is it (we currently host around 300 websites)
  • What problems/difficulties should we anticipate
  • We currently have 2 fairly busy load-balanced (virtual) apache servers. Should nginx be installed on each of these (same box), on a separate box (virtual) in front of the 2, or 2 separate boxes - one in front of each apache server?
  • Should/must nginx be configured on a site-by-site basis, or does it just generally sit in front of everything and know what to do?

Thanks for anything you can tell me!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted
  • Is it worth it?

Yes, specially if you have a lot of static content

  • How difficult is it (we currently host around 300 websites)

Setup is very easy. Nginx is included on CentOS, Ubuntu, etc repos (stable/legacy versions). If you want developer versions (which are fairly stables) you need to compile by yourself.

  • What problems/difficulties should we anticipate

Cache doesn't work as I was expecting. But is a new feature so maybe we need to wait for better results. First time I was using nginx also as load balancer but finally changed to haproxy.

  • We currently have 2 fairly busy load-balanced (virtual) apache servers. Should nginx be installed on each of these (same box), on a separate box (virtual) in front of the 2, or 2 separate boxes - one in front of each apache server?

It depends. I have two apache servers behind a farm of nginx proxies to handle static content. But is possible to install nginx in the same server, indeed is a common configuration.

  • Should/must nginx be configured on a site-by-site basis, or does it just generally sit in front of everything and know what to do?

Site-by-site, but if your sites share the same structure I think is possible to just configure one default site.

share|improve this answer
    
Thank you, this is great info. Can you elaborate on "cache doesn't work as I was expecting"? Also, if we were to install nginx on the same box as apache, would we expect the CPU load / memory utilization to go up or down on that box? –  Brent Sep 24 '09 at 17:32
    
Ok, recent versions of nginx have proxy_cache settings the proxy module. At first time it works fine, but time passed and started to see a lot of 50x errors for cached files. I didn't test further because lack of documentation on this feature. I'd expect memory utilization going down in that box, specially if most part of the load can be handled by nginx (with one or two worker process) insted of apache processes. –  HD. Sep 24 '09 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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