Nginx – Is it possible to install apc, memcached, nginx and varnish all together

memcachednginxvarnish

Just wondering if it is possible to have nginx, apc, memcached, and varnish all running together. i am currently running on a dreamhost private virtual server, not that it matters. any input would be greatly appreciated.

Best Answer

We currently do this in our environment. Specifically:

nginx -> varnish -> apache (with memcached & apc installed). We do this on a RHEL5 box (64bit).

  • nginx runs on port 80 and acts as a proxy for varnish
  • varnish runs on another internal port which acts as a reverse proxy for apache
  • apache is running on another internal port

We added the nginx layer mainly to provide gzip compression on the outgoing requests. It works really well.

One tricky part is keeping the real IP of the initial client all the way down to the apache layer. We achieved this by implementing some custom headers in Varnish's VCL