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 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, SvW, 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.

1 Answer 1

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 http://www.sonassi.com/knowledge-base/magento-kb/mythbusting/why-shouldnt-i-use-nginx-for-magento/ 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 sonassi.com/knowledge-base/magento-kb/mythbusting/… –  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.