Nginx – Varnish/Nginx/Apache/APC/Memcached

apache-2.2Architecturenginxvarnish

I'm setting up a new web server and was wondering if the following is a valid stack:

Varnish in front to cache and split traffic between nginx for static content and Apache with mod_php for dynamic content.

I'd also be running APC as the opcode cache for PHP and memcached as a data cache.

Is this a valid configuration? Do I need to bother running APC if some of my PHP is already being cached by Varnish?

Best Answer

I see some redundancy in your approach. nginx is quite efficient as a web server and loadbalancer and adding a second load balancer on top of it seems pointless.

I personally would prefer having a fronted nginx which serves static content and load balances requests to apache+php

For caching you might want to look into redis I think it's more powerful than memcached. It is definatelly better to have opcode caching in addition to load balancing. You might want to consider xcache as the opcode caching for php.