Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wondering what it the best (most stable with the least memory footprint) arrangment for a busy php+mysql app?

request  > Varnish > Apache
requests > Varnish > Nginx > php5-fpm
requests > Varnish > Nginx  > Apache
requests > Nginx > Varnish  > Apache
something else

I appreciate your hints or references to relevant benchmarks. Thanks

share|improve this question

closed as not constructive by Michael Hampton, Sirex, Sven, EEAA, rnxrx Sep 24 '12 at 1:07

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

Well, I'm not sure how anyone is reliably advising you without knowing ...

  1. Is this going to be for 1 website, or multiple websites (reselling)?
  2. What is the full exact server specification?
  3. What are your targets for traffic (hits, pageviews, bandwidth commitment)?

The advice we give to our customers ...

If you need to re-sell hosting

Nginx > Apache > PHP-FPM

That keeps .htaccess support for your customers, security (chroot/multiple php.inis) from PHP-FPM and static file performance from Nginx.

If it is just for you

Pound > Varnish > Nginx > PHP-FPM

This gives you SSL unwrapping from Pound, static and dynamic (ESI) caching from Varnish, un-cached static content from Nginx and dynamic content from PHP-FPM

If you've got no real experience with Varnish

Apache > PHP-FPM

Our typical architecture is ...

If it helps, for web clusters, we typically use:

lvs (initial ssl load balancing)
    -> pound (ssl-unwrapping) 
    -> varnish (caching) 
    -> haproxy (load balancing) 
    -> nginx (static content) 
    -> php (dynamic content) 
    -> mysql (db)

The truth is that you can do a lot more damage than good with Varnish if you do not set it up properly (cached private sessions, unwanted cookie un-setting). The same applies to Nginx.

Have a read of this and this Building an SSL server farm

My final advice, consult a professional - its money well spent.

share|improve this answer
Thanks mate. Really helpful answer. Just not sure why you choose Apache > PHP-FPM instead of nginx > PHP-FPM – alfish Sep 24 '12 at 20:19
It just depends on the use. Like I described above, different configs are more suitable for different situations. As a web host, Apache is far more suitable on our shared/Magento PaaS platform - and the performance differences are nil. On our Magento MicroCloud architecture, we used Nginx and PHP-FPM. It all comes down to suitability. Don't get caught up in the hype about which web server to use, read this… – Ben Lessani - Sonassi Sep 24 '12 at 22:09

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