I'm testing nginx with different configurations to replace an architecture working with squid + apache. I know that I can use nginx to manage static requests and load balancing but I'm interested in one particular solution that I don't understand clearly:
I'm using 2 nginx servers (balanced) with the proxy_pass setting to pass all requests to an apache server. When one client makes a request to the site one of the nginx servers process it and send it to the apache server. Now, how this behaviour could be an improvement to my system?, it seems that all requests are passing through apache and I don't see benefit at all. What happens when 100 simultaneous connections pass through nginx? The 100 connections will be going to the apache server or is some kind of internal behaviour that allows an small impact into apache?
I know that nginx can perform a lot of functions, but why not delegate each piece of the architecture to software that does one piece of it really well? Consider some, or all, of these pieces: pound or haproxy for the load balancing, varnish or squid for the reverse caching proxy, and having nginx and apache on the back end for static and dynamic content (respectively).
That said, I'm not exactly sure what your question is. You've told nginx to pass all requests (I assume by "pass" you mean not caching them) to an apache back-end. Without caching, the benefit would be distributing the load across multiple apache servers on the back end. If you only have one back-end apache server, then you'll only get the benefit by caching the content, not just passing requests straight through.
More details about your setup, and what you want to do, would help.
Nginx can help your Apache when you have a lot of slow connections to your sites. For example nginx state-machine architecture isn't vulnerable to Slowloris DDoS http://isc.sans.org/diary.html?storyid=6601 .
Agreed - let nginx serve static content directly, and Apache only has to handle the PHP stuff - that means many fewer Apache workers which ultimately means a much better performance.
Agree with Zero*, let enginx handle all static, however, a simpler configuration is just to pass php to the backend, rather than specifying what not to pass to Apache/PHP eg:
location ~ .(php|phtml?)$ { proxy_pass http://backendwww; }