# Can NGinx replace Varnish

**URL:** <https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508>\
**Category:** NGINX\
**Created:** [November 14, 2012, 3:31pm UTC](https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508 "2012-11-14T15:31:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 14, 2012, 3:31pm UTC](https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508/1 "2012-11-14T15:31:50Z")

</div>

We are using Varnish in front of 3 load balanced web servers running  
apache.  
We had migrated from one hosting platform where we had 1 app server and  
1  
database server using Varnish (Drupal 6.x) and had no issues. Now that  
we  
are running in a load balanced environment (3 load balanced apache web  
servers, a Varnish server, and 1 database server) we are seeing mulitple  
examples of cacheing issues. (Pages not displaying correctly …style  
issues, data input staying cached and used on another page, etc).

We think we can just replace the Varnish server and use a NGinx server.  
I  
don’t want to necessarily remove all the apache servers, but we have to  
get  
this cacheing issue corrected…

any thoughts…?

Posted at Nginx Forum:

> **[Can NGinx replace Varnish](https://forum.nginx.org/read.php?2,232796,232796#msg-232796)**
>
> We are using Varnish in front of 3 load balanced web servers running apache. We had migrated from one hosting platform where we had 1 app server and 1 database server using Varnish (Drupal 6.x) and had no issues. Now that we are running in a load...

---

<div class="post-metadata">

**Author:** ![gt420hp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/df788c/32.png) [@gt420hp](https://www.ruby-forum.com/u/gt420hp)\
**Post date:** [November 14, 2012, 6:40pm UTC](https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508/2 "2012-11-14T18:40:34Z")

</div>

On 14 Nov 2012 15h31 CET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> We are using Varnish in front of 3 load balanced web servers running  
> apache. We had migrated from one hosting platform where we had 1  
> app server and 1 database server using Varnish (Drupal 6.x) and had  
> no issues. Now that we are running in a load balanced environment  
> (3 load balanced apache web servers, a Varnish server, and 1  
> database server) we are seeing mulitple examples of cacheing  
> issues. (Pages not displaying correctly …style issues, data input  
> staying cached and used on another page, etc).

You can drop Varnish from the picture if something like microcaching  
suits you or you use ngx\_cache\_purge with the purge module. It depends  
if you have an active invalidation strategy or not. Either way Nginx  
can replace Varnish and work also as load balancer. So you’ll have a  
simpler stack.

> We think we can just replace the Varnish server and use a NGinx  
> server. I don’t want to necessarily remove all the apache servers,  
> but we have to get this cacheing issue corrected…
> 
> any thoughts…?

Yep. See above. For Drupal related Nginx issues there’s a GDO group:

[http://groups.drupal.org/nginx](http://groups.drupal.org/nginx)

if want to delve deeper into the issue.

— appa

---

<div class="post-metadata">

**Author:** ![gt420hp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/df788c/32.png) [@gt420hp](https://www.ruby-forum.com/u/gt420hp)\
**Post date:** [November 15, 2012, 1:37am UTC](https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508/3 "2012-11-15T01:37:46Z")

</div>

Sorry but what does this have to do with your choice of caching  
solution? I’ve used nginx for 8 years, and varnish for 4 years.  
Solution does not matter. Implementation is everything.

If the reverse proxy is not told to stick to a back end based on  
client ip, you will see this behaviour regardless of solution.

You need to sort out your varnish configuration. Replacing it with  
nginx without a complete understanding of your webapp and client  
sessions isn’t going to do anything.

This kind of post, implying that software implementations of RFCs are  
somehow the issue in misconfigurations, needs to be called out  
immediately.

Both nginx and varnish implement the HTTP RFCs, and they do it very  
well. Learn the interfaces to configurations, and use them. It’s  
ridiculous to imply that nginx or varnish is a better implementation  
without objective supporting evidence that can be openly discussed.

* * *

Stefan C.  
CEO, ScaleEngine Inc.  
“Streaming, CDN, and Internet Logistics”  
E: removed\_email\_address@domain.invalid  
Toronto: +1 647 459 9475  
+1 800 224 0192

On Wed, Nov 14, 2012 at 12:39 PM, Antnio P. P. Almeida

---

<div class="post-metadata">

**Author:** ![gt420hp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/df788c/32.png) [@gt420hp](https://www.ruby-forum.com/u/gt420hp)\
**Post date:** [November 14, 2012, 7:33pm UTC](https://www.ruby-forum.com/t/can-nginx-replace-varnish/224508/4 "2012-11-14T19:33:46Z")

</div>

On Wed, Nov 14, 2012 at 09:31:28AM -0500, gt420hp wrote:

Hi there,

> we are seeing mulitple  
> examples of cacheing issues. (Pages not displaying correctly …style  
> issues, data input staying cached and used on another page, etc).
> 
> We think we can just replace the Varnish server and use a NGinx server. I  
> don’t want to necessarily remove all the apache servers, but we have to get  
> this cacheing issue corrected…

If the caching issues are because your backend servers are configured  
incorrectly, merely replacing Varnish with nginx is unlikely to fix  
everything.

If they are because your Varnish is configured incorrectly, then  
replacing an incorrectly-configured Varnish with a correctly-configured  
nginx probably will help. But replacing it with a correctly-configured  
Varnish would probably also help.

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
