symfony2-nginx-varnish icon indicating copy to clipboard operation
symfony2-nginx-varnish copied to clipboard

Just a question

Open yellow1912 opened this issue 12 years ago • 5 comments

but is there any reason to use Varnish? Can't we use nginx as well which seems to be able to do anything that Varnish can (and even better?). That way we have less softwares to manage? Would be nice if you can try that setup and share what works for you as well. Can be a new branch for this git?

yellow1912 avatar Nov 08 '13 15:11 yellow1912

Varnish is used as a reverse-proxy. I'm not familair with nginx reverse proxy functionality and how it fares against Varnish. Would be interesting to see benchmarks. Does it support ESI?

You don't have to use Varnish, it's a matter of couple lines in nginx vhost config file. I guess I could add them as comments if that would help?

inoryy avatar Nov 08 '13 15:11 inoryy

Nginx has a module for esi. By default i think it supports ssi which is also supported by sf2. I think it is nice to add a scenario with nginx only because there will be less softwares to learn and maintain

yellow1912 avatar Nov 09 '13 08:11 yellow1912

From what I can gather, SSI is an unsupported predecessor to ESI, so I would not recommend using it. And I can't gather any reasonable information on ESI module for nginx, let alone good comparison with Varnish. Furthermore, I have a feeling that setting it up will be harder than Varnish because you have to manually rebuild nginx to add support for modules that are not in the core, which is never a fun activity..

As I mentioned, Varnish usage is not forced here. Only real change you need apart from simply not installing Varnish is to remove the real_ip setting in nginx config and replace listen 8080 with listen 80 at the top of vhost config file. I'm not sure that warrants a separate branch..

inoryy avatar Nov 09 '13 08:11 inoryy

So without varnish we would not be able to enjoy the power of serving part of the site through a reverse proxy layer tho? I'm very sorry for asking such noobish question. And thank you very much for being patient so far

yellow1912 avatar Nov 09 '13 09:11 yellow1912

I can't say I'm qualified to talk about this because I've never heard about reverse proxy capabilities of nginx until today.

If all you're after is the caching mechanism, then Symfony2 actually provides a relatively good implementation of it out of the box - see HTTP Cache docs. You only need Varnish if you want to scale out and use fancy things like ESI.

inoryy avatar Nov 09 '13 10:11 inoryy